# 非法参数异常：字段 [comments] 中的嵌套文档数量超过 10000 的限制

- **ID:** `elasticsearch/too-many-nested-documents-under-field`
- **领域:** elasticsearch
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

单个文档在嵌套字段中包含超过 10,000 个嵌套文档，触发了默认映射限制。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 7.17.10 | active | — | — |
| 8.8.0 | active | — | — |
| 8.14.0 | active | — | — |

## 解决方案

1. ```
   针对特定索引增加限制：PUT /my_index/_settings { "index.mapping.nested_objects.limit": 20000 }
   ```
2. ```
   重新设计数据模型，对大数组使用父子关系（join 字段）代替嵌套文档。
   ```

## 无效尝试

- **** — High nested object counts degrade query performance and increase memory usage; the limit exists for a reason. (60% 失败率)
- **** — Flattening breaks nested query functionality (e.g., matching parent-child relationships across arrays), causing incorrect search results. (75% 失败率)
