Searching in indices between 2 date ranges without creating aliases

( #1

Let's consider i indices with dates, example: index1-26-10-2018 , index1-27-10-2018 , index1-28-10-2018 . Is there any way to search on index name which will mean : from index1-26-10-2018 to index1-28-10-2018 .

I'ved looked into date math index names but this won't help in my case. I've also thought about regex but index names don't support anything but a wildcard.

Does anyone have an idea?


(Alexander Reelsen) #2

can you explain why date math is not working in your case? You are aware that you can specify custom formats, right?

You always have the option to just specify the three indices manually and separate by comma like index1-26-10-2018,index1-27-10-2018,index1-28-10-2018

Hope this helps!

( #3

Thanks for the reply.

I'm aware of specific formats, but i have daily indices and allowing search for a year back.
So i'f i'll implement something that translates a range of a year to a daily index list i'll perform query with a 365 index names, and i'm trying to avoid this.

(Christian Dahlqvist) #4

Which version of Elasticsearch are you using? How come you have named your indices this way instead of the more common format with year followed by month and date, which is sortable and potentially easier to use with prefixes?

( #5

@Christian_Dahlqvist thank you for the reply.

Lets assume i can change the index names.
Is there any way i can search on a range of index names?

For example:
search from 29.10.18 - 30.10.18 will translate to indices 29.10.2018,30.10.2018
search from 29.10-18 - 29.19.19 will be translated to 365 daily index names in the request.

I thought about using wildcards based on the differences between the 2 ranges, but thought about checking some more intuitive solution first.

(Christian Dahlqvist) #6

Which version of Elasticsearch are you using?

( #7


(system) #8

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