Caching
In Elasticsearch 5.0, a lot of refactoring has been done to support better caching. The different types of cache available are as follows:
- Node Query cache: Queries that run in filter context are cached here
- Shard request cache: The results of the entire query are cached here
Node Query cache
Queries, such as numeric or date range, which run in the filter context are great candidates for caching. Since they have no scoring phase, they can be reused. The Node query cache is a smart cache; you do not have to worry about invalidating the cache. Individual queries that run in filter context are cached here. This cache is maintained at a node level and defaults to 10%
of the heap and can be configured using the elasticsearch.yml
file:
indices.queries.cache.size: 10%
Frequently used queries are automatically cached, and the eviction from the cache is based on the least recently used queries.
Shard request cache
Shard request cache is used to cache the results of the entire query. Only hits count...