query_cache.asciidoc 1.6 KB

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