节点(Nodes)

class elasticsearch.client.NodesClient

To use this client, access client.nodes from an Elasticsearch client. For example:

from elasticsearch import Elasticsearch

# Create the client instance
client = Elasticsearch(...)
# Use the nodes client
client.nodes.<method>(...)
clear_repositories_metering_archive(*, node_id, max_archive_version, error_trace=None, filter_path=None, human=None, pretty=None)

清除归档仓库计量数据。 清除集群中归档仓库的计量信息。

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-clear-repositories-metering-archive

Parameters:
  • node_id (str | Sequence[str]) – 用于限制返回信息的节点ID或名称的逗号分隔列表

  • max_archive_version (int) – 指定要从存档中清除的最大`archive_version`

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

get_repositories_metering_info(*, node_id, error_trace=None, filter_path=None, human=None, pretty=None)

获取集群仓库计量信息。 获取集群的仓库计量信息。 此API暴露单调非递减计数器,预期客户端会持久存储计算时间段内聚合所需的信息。 此外,此API暴露的信息是易失的,意味着节点重启后将不复存在。

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-get-repositories-metering-info

Parameters:
  • node_id (str | Sequence[str]) – 用于限制返回信息的节点ID或名称的逗号分隔列表

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

hot_threads(*, node_id=None, error_trace=None, filter_path=None, human=None, ignore_idle_threads=None, interval=None, pretty=None, snapshots=None, sort=None, threads=None, timeout=None, type=None)

获取节点热点线程。 获取集群中每个选定节点的热点线程详细分析。 输出为纯文本格式,包含每个节点顶部热点线程的分析。

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-hot-threads

Parameters:
  • node_id (str | Sequence[str] | None) – 用于限制返回信息的节点ID或名称列表

  • ignore_idle_threads (bool | None) – 如果为true,已知空闲线程(如在socket选择中等待,或从空队列获取任务)将被过滤

  • interval (str | Literal[-1] | ~typing.Literal[0] | None) – 进行线程第二次采样的间隔时间

  • snapshots (int | None) – 线程堆栈跟踪的采样次数

  • sort (str | Literal['block', 'cpu', 'gpu', 'mem', 'wait'] | None) – ‘cpu’类型的排序方式(默认: total)

  • threads (int | None) – 指定要提供信息的热点线程数量

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待响应的超时时间。如果超时前未收到响应,请求将失败并返回错误

  • type (str | Literal['block', 'cpu', 'gpu', 'mem', 'wait'] | None) – 采样类型

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

TextApiResponse

info(*, node_id=None, metric=None, error_trace=None, filter_path=None, flat_settings=None, human=None, pretty=None, timeout=None)

获取节点信息。

默认情况下,API返回集群节点的所有属性和核心设置。

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-info

Parameters:
  • node_id (str | Sequence[str] | None) – 用于限制返回信息的节点ID或名称的逗号分隔列表

  • metric (str | Sequence[str] | None) – 限制返回的特定指标。支持逗号分隔列表,如http,ingest

  • flat_settings (bool | None) – 如果为true,以扁平格式返回设置

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待响应的超时时间。如果超时前未收到响应,请求将失败并返回错误

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

reload_secure_settings(*, node_id=None, error_trace=None, filter_path=None, human=None, pretty=None, secure_settings_password=None, timeout=None, body=None)

重新加载集群节点上的密钥库。

安全设置存储在磁盘上的密钥库中。其中某些设置是可重新加载的。 也就是说,您可以在磁盘上更改它们并重新加载,而无需重启集群中的任何节点。 当您更新了密钥库中可重新加载的安全设置后,可以使用此API在每个节点上重新加载这些设置。

当Elasticsearch密钥库受密码保护且不仅是被混淆时,重新加载安全设置时必须提供密钥库密码。 为整个集群重新加载设置假设所有节点的密钥库都使用相同密码保护;此方法仅在节点间通信加密时允许使用。 或者,您可以通过本地访问API并传递节点特定的Elasticsearch密钥库密码,在每个节点上单独重新加载安全设置。

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-reload-secure-settings

Parameters:
  • node_id (str | Sequence[str] | None) – 要定位的集群中特定节点名称

  • secure_settings_password (str | None) – Elasticsearch密钥库的密码

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待响应的超时时间。如果超时前未收到响应,请求将失败并返回错误

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

  • body (Dict[str, Any] | None)

Return type:

ObjectApiResponse[Any]

stats(*, node_id=None, metric=None, index_metric=None, completion_fields=None, error_trace=None, fielddata_fields=None, fields=None, filter_path=None, groups=None, human=None, include_segment_file_sizes=None, include_unloaded_segments=None, level=None, pretty=None, timeout=None, types=None)

获取节点统计信息。 获取集群中节点的统计信息。 默认返回所有统计项。可以通过指定指标来限制返回的信息。

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-stats

Parameters:
  • node_id (str | Sequence[str] | None) – 用于限制返回信息的节点ID或名称的逗号分隔列表

  • metric (str | Sequence[str] | None) – 限制返回的统计信息为指定指标

  • index_metric (str | Sequence[str] | None) – 限制索引指标返回的特定索引统计信息。仅当指定了indices(或all)指标时可用

  • completion_fields (str | Sequence[str] | None) – 包含在fielddata和建议统计中的字段的逗号分隔列表或通配符表达式

  • fielddata_fields (str | Sequence[str] | None) – 包含在fielddata统计中的字段的逗号分隔列表或通配符表达式

  • fields (str | Sequence[str] | None) – 包含在统计信息中的字段的逗号分隔列表或通配符表达式

  • groups (bool | None) – 包含在搜索统计中的搜索组的逗号分隔列表

  • include_segment_file_sizes (bool | None) – 如果为true,调用将报告每个Lucene索引文件的聚合磁盘使用情况(仅在请求段统计时适用)

  • include_unloaded_segments (bool | None) – 如果为`true`,响应包含未加载到内存中的段的信息

  • level (str | Literal['cluster', 'indices', 'shards'] | None) – 指示统计信息是在集群、索引还是分片级别聚合

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待响应的超时时间。如果在超时到期前未收到响应,请求将失败并返回错误

  • types (Sequence[str] | None) – 索引指标文档类型的逗号分隔列表

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]

usage(*, node_id=None, metric=None, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None)

获取功能使用情况信息。

https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-usage

Parameters:
  • node_id (str | Sequence[str] | None) – 用于限制返回信息的节点ID或名称的逗号分隔列表;使用`_local`返回当前连接节点的信息,留空获取所有节点信息

  • metric (str | Sequence[str] | None) – 限制返回的特定指标信息。逗号分隔的可选值列表:_all, rest_actions

  • timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待响应的超时时间。如果在超时到期前未收到响应,请求将失败并返回错误

  • error_trace (bool | None)

  • filter_path (str | Sequence[str] | None)

  • human (bool | None)

  • pretty (bool | None)

Return type:

ObjectApiResponse[Any]