|
1 | 1 | [[query-cache]] |
2 | 2 | === Node Query Cache |
3 | 3 |
|
4 | | -The query cache is responsible for caching the results of queries. |
5 | | -There is one queries cache per node that is shared by all shards. |
6 | | -The cache implements an LRU eviction policy: when a cache becomes full, the |
7 | | -least recently used data is evicted to make way for new data. |
8 | | -It is not possible to look at the contents being cached. |
| 4 | +The results of queries used in the filter context are cached in the node query |
| 5 | +cache for fast lookup. There is one queries cache per node that is shared by all |
| 6 | +shards. The cache uses an LRU eviction policy: when the cache is full, the least |
| 7 | +recently used query results are evicted to make way for new data. You cannot |
| 8 | +inspect the contents of the query cache. |
9 | 9 |
|
10 | | -The query cache only caches queries which are being used in a filter context. |
| 10 | +Term queries and queries used outside of a filter context are not eligible for |
| 11 | +caching. |
| 12 | + |
| 13 | +By default, the cache holds a maximum of 10000 queries in up to 10% of the total |
| 14 | +heap space. To determine if a query is eligible for caching, {es} maintains a |
| 15 | +query history to track occurrences. |
| 16 | + |
| 17 | +Caching is done on a per segment basis if a segment contains at least 10000 |
| 18 | +documents and the segment has at least 3% of the total documents of a shard. |
| 19 | +Because caching is per segment, merging segments can invalidate cached queries. |
11 | 20 |
|
12 | 21 | The following setting is _static_ and must be configured on every data node in |
13 | 22 | the cluster: |
14 | 23 |
|
15 | 24 | `indices.queries.cache.size`:: |
16 | | - |
17 | 25 | Controls the memory size for the filter cache , defaults to `10%`. Accepts |
18 | 26 | either a percentage value, like `5%`, or an exact value, like `512mb`. |
19 | 27 |
|
20 | | -The following setting is an _index_ setting that can be configured on a |
| 28 | +The following setting is an _index_ setting that can be configured on a |
21 | 29 | per-index basis. Can only be set at index creation time or on a |
22 | 30 | <<indices-open-close,closed index>>: |
23 | 31 |
|
24 | 32 | `index.queries.cache.enabled`:: |
25 | | - |
26 | 33 | Controls whether to enable query caching. Accepts `true` (default) or |
27 | 34 | `false`. |
0 commit comments