Hi, this follows previous questions. I have merged all my indices into 1 ilm based index, with a added field that contains the previous "index" name...
Generally this is fine, with some performance hit. Queries are generally a but slower, but OK. I've done this for scalability as I had to many indices. However I am finding a particular query to be much slower...
I am trying to determine the min and max date of a range of documents. On the same test node (which has the new merged index and all the old indices) using the previous many index model, the query returns in 260ms but the same query on the newly merged index it takes 2500ms. What is going on?
I run two queries and sort by date in both direction, taking the top document.
{
"query": {
"bool": {
"must": [
{
"term": {
"dataseriesId": dataseriesId
}
},
{
"range": {
"date": {
"gte": from.format(),
"lte": to.format()
}
}
}
]
}
},
"sort": {
"date": sort
},
"size": 1
}
which gives me the document with the min and max of the date field for docs with the given dataseriesId.
from and to are my chosen date range.
index template mapping is
mappings: {
_source: {
enabled: true
},
_routing: {
required: false
},
properties: {
type: { type: 'keyword', index: true },
datasetId: { type: 'keyword', index: true },
dataseriesId: { type: 'keyword', index: true },
date: { type: 'date', format: 'date_time_no_millis' },
floatValue: { type: 'float', index: false, ignore_malformed: true, coerce: false },
stringValue: { type: 'keyword', index: false },
dateValue: { type: 'date', index: false, format: 'date_time_no_millis' }
}
},