Is there an easy way that can search specify indices, if not, search all?

Now I have many data and indices, and search is slower, but most data can be searched in a year's indices(I split data by month), so I want to search latest 1 year first, if not get result, try to search all.

I can do this by two request, but I want to know if there's a way to do this once, for example, can I point exact indices first and append * at last, like this: http://ip:port/index1,index2,index3,index*/_search
if limit 1, will this find by sequence and when it find stop other search?

Hey,

there is an early termination feature, see here https://www.elastic.co/guide/en/elasticsearch/client/java-api/7.2/java-search-terminate-after.html

However this still would query each shard that is involved.

Are you searching for documents or aggregating only?

--Alex

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