How can I get all indices matching a given name pattern from the Golang Client

I have created document indexes in OpenSearch of the form

prefix-id

where prefix is the prefix I want to give all of the indices I create, and then ID is created randomly.

What Golang client call can I make that would get all indices that start with my prefix? I have looked through the API and found nothing that seems promising.

Thanks!
-Keith

When you query an index, you can usually use wildcards, so a simple [prefix]* set as the index would probably work

Thanks!

However, I don’t want to query all the indices. What I want is a listing of the names of all indices that have my prefix.

Best,
-Keith

Oh, that’s even easier. Query [opensearch route]/_cat/indices/[prefix]* (might want to add “?v” at the end of the URL to get columns).
A simple GET request should get it to you, you can even navigate there with the browser!

1 Like