悬挂索引(Dangling Indices)
- class elasticsearch.client.DanglingIndicesClient
To use this client, access
client.dangling_indicesfrom anElasticsearchclient. For example:from elasticsearch import Elasticsearch # Create the client instance client = Elasticsearch(...) # Use the dangling_indices client client.dangling_indices.<method>(...)
- delete_dangling_index(*, index_uuid, accept_data_loss, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)
删除一个悬空索引。
当Elasticsearch遇到当前集群状态中不存在的索引数据时,这些索引会被视为悬空索引。
例如,当Elasticsearch节点离线时,如果你删除了超过
cluster.indices.tombstones.size数量的索引,就可能发生这种情况。- Parameters:
index_uuid (str) – 要删除索引的UUID。使用获取悬空索引API来查找UUID。
accept_data_loss (bool) – 此参数必须设置为true以确认将无法再从悬空索引中恢复数据。
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 指定连接到主节点的超时时间
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 显式操作超时
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- import_dangling_index(*, index_uuid, accept_data_loss, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)
导入一个悬空索引。
当Elasticsearch遇到当前集群状态中不存在的索引数据时,这些索引会被视为悬空索引。
例如,当Elasticsearch节点离线时,如果你删除了超过
cluster.indices.tombstones.size数量的索引,就可能发生这种情况。- Parameters:
index_uuid (str) – 要导入索引的UUID。使用获取悬空索引API来定位UUID。
accept_data_loss (bool) – 此参数必须设置为true才能导入悬空索引。因为Elasticsearch无法知道悬空索引数据的来源,也无法确定哪些分片副本是新的哪些是旧的,所以不能保证导入的数据代表索引最后一次在集群中的最新状态。
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 指定连接到主节点的超时时间
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 显式操作超时
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- list_dangling_indices(*, error_trace=None, filter_path=None, human=None, pretty=None)
获取悬空索引。
当Elasticsearch遇到当前集群状态中不存在的索引数据时,这些索引会被视为悬空索引。
例如,当Elasticsearch节点离线时,如果你删除了超过
cluster.indices.tombstones.size数量的索引,就可能发生这种情况。使用此API可以列出悬空索引,然后你可以选择导入或删除它们。