# MongoDB Atlas Search 索引同步失败：集合 'products' 上的索引 'search_idx' 处于同步状态 'FAILED'

- **ID:** `mongodb/atlas-search-index-sync-failure`
- **领域:** mongodb
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Atlas Search 索引定义包含无效映射（例如引用不存在的字段、使用不支持的解析器或超出字段限制），导致索引同步过程失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| MongoDB Atlas (M10+ clusters) | active | — | — |
| Atlas Search 1.0 | active | — | — |
| Atlas Search 2.0 | active | — | — |

## 解决方案

1. ```
   在 Atlas UI 的搜索索引详情面板中检查详细错误消息。常见修复：删除不支持的字段类型（例如混合类型的数组）或更正解析器名称（例如使用 'lucene.standard' 而不是 'standard'）。
   ```
2. ```
   使用 Atlas Search API 检索索引状态：`curl -s -u "username:apiKey" "https://cloud.mongodb.com/api/atlas/v1.0/groups/{groupId}/clusters/{clusterName}/fts/indexes/{indexId}" | jq '.status'`。然后使用更正后的映射更新索引定义。
   ```
3. ```
   简化索引定义，只包含必要字段，然后逐步添加字段并监控同步状态。
   ```

## 无效尝试

- **** — The underlying mapping error persists; the new index will also fail to sync. (95% 失败率)
- **** — The failure is due to schema validation, not resource constraints. (90% 失败率)
- **** — Atlas Search sync is asynchronous and does not re-validate the index definition on document insertion. (85% 失败率)
