Bit new to Elasticsearch. When limiting the date range of a query (for example if I have a daily index of events and I'd like to search within only a non-aligned monthly cycle), is it worth optimising the index pattern?
My application exposes a query API which is internally translated into an Elasticsearch query. If I want to query only in dates 2020-05-17 to 2020-06-17, should my application optimise the query knowing the format of index names:
GET /events-2020.05.17,events-2020.05.18,<...>/_search
{
"query": {
"bool": {
"filter": [
{
"range": {
"someMetric": {
"gte": 0.9
}
}
}
]
}
}
}
vs
GET /events-*/_search
{
"query": {
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"gte": "2020-05-17",
"lt": "2020-06-17"
}
}
},
{
"range": {
"someMetric": {
"gte": 0.9
}
}
}
]
}
}
}