Elasticsearch - What is the best way to find existing indices in a time range

82 views Asked by At

Below is an example of indices in Jan 2015, similar indices in other months/years. Indices are created based on date but it's not necessary to have indices for everyday.

abc-2015.01.01
abc-2015.01.04
abc-2015.01.14
abc-2015.01.28
abc-2015.01.31

I am trying to query all the existing indices in a time range, for example, all the indices in 2015, we may do curl -XGET 'http://localhost:9200/abc-2015*/_aliases/'

but how about querying From Jan 13,2015 to Feb, 28 2015? we may do curl -XGET 'http://localhost:9200/abc-2015-01*,abc-2015-02*/_aliases/'

However, it returns the indices outside of the range in Jan and Feb as well. What is the best way to query all the existing indices efficiently?

1

There are 1 answers

0
bittusarkar On

The easiest way to query in indices between 2015-01-13 to 2015-02-28 AFAIK is as under: http://localhost:9200/abc-2015.01.13,abc-2015.01.14,abc-2015.01.15,abc-2015.01.16,abc-2015.01.17,abc-2015.01.18,abc-2015.01.19,abc-2015.01.2*,abc-2015.01.3*,abc-2015.02.*/_aliases/.