# IllegalArgumentException: number of nested documents in field [comments] exceeds the limit of 10000

- **ID:** `elasticsearch/too-many-nested-documents-under-field`
- **Domain:** elasticsearch
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

A single document contains more than 10,000 nested documents in a nested field, hitting the default mapping limit.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.17.10 | active | — | — |
| 8.8.0 | active | — | — |
| 8.14.0 | active | — | — |

## Workarounds

1. **Increase the limit for the specific index: PUT /my_index/_settings { "index.mapping.nested_objects.limit": 20000 }** (90% success)
   ```
   Increase the limit for the specific index: PUT /my_index/_settings { "index.mapping.nested_objects.limit": 20000 }
   ```
2. **Redesign the data model to use parent-child relationships (join field) instead of nested documents for large arrays.** (80% success)
   ```
   Redesign the data model to use parent-child relationships (join field) instead of nested documents for large arrays.
   ```

## Dead Ends

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