We hava huge amount of date histogram query, so i want to know whether the partial result of date histogram query can be cached.
For example, i query avg(cost) of last 1 hour group by 1m interval at 01:00, and then i do a same query at 01:05. Can the result of 00:05~01:00 be cached? It can save CPU resource in a great measure
Thanks!
Some aspects of queries and aggregations are cached. Parts of the lucene query will internally cache so that finding the documents is faster in the future, aggregations have a "request cache" which caches agg responses, and the file system caches hot index files.
The request cache is particularly useful if there are many shards involved in a search. E.g. if you have an index-per-day and search the last 7 days, only the two ends of the 7 day range are likely to change. So the internal 5 days get cached and only the two end days are updated.
So the short answer is that yes, there is caching involved. We don't do fine-level caching though, since it is easy to fill a cache with values that are never used again and it causes a lot of churn. For that level we rely on the OS to keep hot mmapped index/doc value files in memory.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.