Variable for term of particular index in a data source

Hi Community,

I have a data source that have many indexes and we have to use same data source which is of type elastic search.
Now the requirement is: I have to put a template variable that lists a products of particular index and pass that to the query.

Below query not working in variable:
{“find”: “terms”, “field”: “product”, “query”: “indexname”}

TIA.