悬空索引 API
1.0 版引入
节点加入集群后,如果节点本地目录中存在集群中尚不存在的分片,则会发生悬空索引。悬空索引可以列出、删除或导入。
端点
列出悬空索引
GET /_dangling
导入悬空索引
POST /_dangling/<index-uuid>
删除悬空索引
DELETE /_dangling/<index-uuid>
路径参数
路径参数为必填项。
路径参数 | 描述 |
---|---|
index-uuid | 索引的 UUID。 |
查询参数
查询参数为可选项。
查询参数 | 数据类型 | 描述 |
---|---|---|
accept_data_loss | 布尔型 | 对于 import 或 delete 操作,必须将其设置为 true ,因为 OpenSearch 不知道悬空索引数据来源。 |
timeout | 时间单位 | 等待响应的时间。如果在定义的时间段内未收到响应,则返回错误。默认值为 30 秒。 |
cluster_manager_timeout | 时间单位 | 等待连接到集群管理器的时间。如果在定义的时间段内未收到响应,则返回错误。默认值为 30 秒。 |
示例请求
示例列表
GET /_dangling
示例导入
POST /_dangling/msdjernajxAT23RT-BupMB?accept_data_loss=true
示例删除
DELETE /_dangling/msdjernajxAT23RT-BupMB?accept_data_loss=true
示例响应
{
"_nodes": {
"total": 1,
"successful": 1,
"failed": 0
},
"cluster_name": "opensearch-cluster",
"dangling_indices": [msdjernajxAT23RT-BupMB]
}