# Elasticsearch异常：索引 [my_index] 分片 [0] 段 [_a1b2c3] 检测到字段缓存合并争用

- **ID:** `elasticsearch/field-cache-merge-contention`
- **领域:** elasticsearch
- **类别:** runtime_error
- **错误码:** `ES_FIELD_CACHE_MERGE_CONTENTION`
- **验证级别:** ai_generated
- **修复率:** 82%

## 根因

并发段合并触发字段缓存重建，当多个合并尝试更新相同缓存条目时，导致争用和延迟增加。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 7.17.0 | active | — | — |
| 8.11.0 | active | — | — |
| 8.12.0 | active | — | — |

## 解决方案

1. ```
   Reduce merge concurrency by setting `index.merge.scheduler.max_thread_count: 2` and `index.merge.scheduler.max_merge_count: 6`.
   ```
2. ```
   Use `indices.fielddata.cache.expire: 30m` to clear field cache periodically, reducing contention windows.
   ```
3. ```
   Force merge indices during maintenance windows: `POST my_index/_forcemerge?max_num_segments=1`.
   ```

## 无效尝试

- **** — Reduces merge concurrency but increases merge time and can lead to too many segments, degrading search performance. (80% 失败率)
- **** — Larger cache delays contention but doesn't prevent it; high memory usage may cause OOM. (70% 失败率)
