Is there any approach in java using which we can find out the list of indexes contributed in creating response against the query fired

Is there any approach in java using which we can find out the list of indexes contributed in creating response against the query fired.

Example: A query is executed against 5 indices in one request and only 2 contributed in generating the response, so i am looking for a way by which i should get the names of indexes which contributed in response and ignore the remaining 3.

http://localhost:9200/index1, index2, index3, index4, index5/_search

In all these 5 index, inde1 and index 2 is contributing in producing response.

The SearchHit exposes the getIndex() method:

Or may be you would like to run a Terms agg on _index field?

1 Like

Thanks @dadoonet it worked :+1:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.