2015-06-26 10:31:38 -04:00
|
|
|
[[query-cache]]
|
2020-06-01 09:44:32 -04:00
|
|
|
=== Node query cache settings
|
2015-06-26 10:31:38 -04:00
|
|
|
|
2020-01-20 05:11:57 -05:00
|
|
|
The results of queries used in the filter context are cached in the node query
|
|
|
|
cache for fast lookup. There is one queries cache per node that is shared by all
|
|
|
|
shards. The cache uses an LRU eviction policy: when the cache is full, the least
|
|
|
|
recently used query results are evicted to make way for new data. You cannot
|
|
|
|
inspect the contents of the query cache.
|
2015-06-26 10:31:38 -04:00
|
|
|
|
2020-01-20 05:11:57 -05:00
|
|
|
Term queries and queries used outside of a filter context are not eligible for
|
|
|
|
caching.
|
|
|
|
|
|
|
|
By default, the cache holds a maximum of 10000 queries in up to 10% of the total
|
|
|
|
heap space. To determine if a query is eligible for caching, {es} maintains a
|
|
|
|
query history to track occurrences.
|
|
|
|
|
|
|
|
Caching is done on a per segment basis if a segment contains at least 10000
|
|
|
|
documents and the segment has at least 3% of the total documents of a shard.
|
|
|
|
Because caching is per segment, merging segments can invalidate cached queries.
|
2015-06-26 10:31:38 -04:00
|
|
|
|
|
|
|
The following setting is _static_ and must be configured on every data node in
|
|
|
|
the cluster:
|
|
|
|
|
|
|
|
`indices.queries.cache.size`::
|
|
|
|
Controls the memory size for the filter cache , defaults to `10%`. Accepts
|
|
|
|
either a percentage value, like `5%`, or an exact value, like `512mb`.
|
|
|
|
|
2020-01-20 05:11:57 -05:00
|
|
|
The following setting is an _index_ setting that can be configured on a
|
2019-12-10 14:23:14 -05:00
|
|
|
per-index basis. Can only be set at index creation time or on a
|
|
|
|
<<indices-open-close,closed index>>:
|
2016-04-07 09:46:32 -04:00
|
|
|
|
|
|
|
`index.queries.cache.enabled`::
|
|
|
|
Controls whether to enable query caching. Accepts `true` (default) or
|
|
|
|
`false`.
|