I originally posted the question to Stack Overflow but I guess it's more appropriate to ask here. (For reference, the original question is here - caching - Elasticsearch doesn't cache query with rounded date - Stack Overflow
I'm using this Elasticsearch query:
{
"query": {
"constant_score": {
"filter": {
"bool": {
"must": [
{"term": {"address.country.keyword": "Germany"}},
{"term": {"address.city.keyword": "Berlin"}},
{"range": {"timestamp": {"gte": "now-3d/h"}}}
]
}
}
}
},
"size": 0
}
AFAICT this should qualify the query for caching, at least based on these resources:
- Tune for search speed | Elasticsearch Reference [6.2] | Elastic
- Common options | Elasticsearch Reference [6.2] | Elastic
- Shard request cache settings | Elasticsearch Guide [7.12] | Elastic
However, according to the /_stats/request_cache
endpoint caching is not involved - hit_count
stays the same. If I remove the range clause, it works. Also if I change the time specification to now/h
, it also works. Am I missing something?
Elasticsearch's version is 6.2.3.