Dynamically fetch available indices for listIndices in Vue

This was a question from support I’m posting here for posteriority:

How do I find all the indices to use for sorting in Vue InstantSearch?

This is not a automatic capability, since it can expose more data to the users than what you want them to, but if you understand that caveat, I’ve made a demo here:

Note that the api key used for the search client should be a custom made key which has access to 1. listIndexes and 2. search. Don’t simply use an admin API key, because users will be able to modify any data in your index at that point. You can create a new index via the dashboard. I attached a screenshot on how to do that.You can also the restrict the visible indices there.

58