Hi there!
I've got a index with ~12 Mio documents. All the documents have the same fields. The field "availability" is defined like that in the mapping:
"availability" : {
"type" : "long",
"store" : true
}
Now I wanted to query all documents without any filter. In the first version, I did the following query with some aggregations:
{
"query" : {
"bool": {
"must": [{
"match_all": {}
}, {
"range": {
"availability": {
"lte": 10
}
}
}]
}
},
"from": 0,
"size": 100
}
The thing is, that every document has availability < 10. We've had this match_all and the availability < 10 in our query builder as fallback.
During performance optimization we tried to delete these two filters (which do not filter) and performed the following query with some aggregations.
{
"from": 0,
"size": 100
}
The aggregations have been the same in both cases. But why is it, that the first version required 3/4 times longer than the second?
Is that because elasticsearch can not shrink the documents based on the filters? Or does it take longer because elastic has to calculate the score based on these (useless) filters? Or are both wrong and there is another reason?
We've increased the performance - but it would be great to understand, why the difference is that high.
I'm happy about any answer!
Thank you.
Alex