Shard request cache vs Node Query Cache

the request cache is a high level cache that operates on a point in time snapshot of the data that caches the entire result of the request and uses the search request itself as a cache key. it's invalidated once the point-in-time snapshot goes out of scope ie. due to the index/shard being refreshed. It's caching agg results as well as top N.

In contrast to the query cache which operates on a lower level. Queries are cached per index segment that might survive index refreshes. A shard is composed out of segments that are merged if with new segments. if such a merge happens and the source segments go out of scope the cache is invalidated. Also the query cache caches individual subqueries independent of the search request. ie different requests can produce cache hits in the query cache but not in the request cache.

hope that helps

3 Likes