elasticsearch
resource_error
ai_generated
partial
OutOfMemoryError: Java heap space (field cache eviction)
ID: elasticsearch/field-cache-eviction-out-of-memory
78%Fix Rate
82%Confidence
1Evidence
2023-11-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.10.2 | active | — | — | — |
| 8.0.0 | active | — | — | — |
| 8.12.1 | active | — | — | — |
Root Cause
The field data cache or filter cache consumes too much heap memory, and eviction triggers an OOM because the JVM cannot free enough space.
generic中文
字段数据缓存或过滤器缓存消耗过多堆内存,逐出操作导致 JVM 无法释放足够空间而触发内存溢出。
Official Documentation
https://www.elastic.co/guide/en/elasticsearch/reference/current/circuit-breaker.htmlWorkarounds
-
85% success Reduce the field data cache size in elasticsearch.yml: indices.fielddata.cache.size: 20% of heap. Restart the node for the change to take effect.
Reduce the field data cache size in elasticsearch.yml: indices.fielddata.cache.size: 20% of heap. Restart the node for the change to take effect.
-
80% success Enable the fielddata circuit breaker with a lower limit: PUT /_cluster/settings { "persistent": { "indices.breaker.fielddata.limit": "30%" } }
Enable the fielddata circuit breaker with a lower limit: PUT /_cluster/settings { "persistent": { "indices.breaker.fielddata.limit": "30%" } }
中文步骤
在 elasticsearch.yml 中减少字段数据缓存大小:indices.fielddata.cache.size: 20% of heap。重启节点使更改生效。
启用字段数据断路器并设置较低限制:PUT /_cluster/settings { "persistent": { "indices.breaker.fielddata.limit": "30%" } }
Dead Ends
Common approaches that don't work:
-
80% fail
Larger heap only delays the OOM; the field cache can still grow unbounded and eventually exhaust memory.
-
90% fail
Disabling the cache causes severe performance degradation for aggregations and sorting on text fields, leading to query failures.