Fleet
- class elasticsearch.client.FleetClient
To use this client, access
client.fleet
from anElasticsearch
client. For example:from elasticsearch import Elasticsearch # Create the client instance client = Elasticsearch(...) # Use the fleet client client.fleet.<method>(...)
- global_checkpoints(*, index, checkpoints=None, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None, wait_for_advance=None, wait_for_index=None)
获取全局检查点。
获取索引的当前全局检查点。 此API专为Fleet服务器项目内部使用而设计。
https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-fleet
- Parameters:
index (str) – 单个索引或解析为单个索引的索引别名。
checkpoints (Sequence[int] | None) – 以逗号分隔的先前全局检查点列表。当 与`wait_for_advance`结合使用时,API将仅在全局检查点 超过指定检查点后返回。提供空列表将导致Elasticsearch 立即返回当前全局检查点。
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待全局检查点超过`checkpoints`的时间段。
wait_for_advance (bool | None) – 布尔值,控制是否等待(直到超时)全局检查点 超过提供的`checkpoints`。
wait_for_index (bool | None) – 布尔值,控制是否等待(直到超时)目标索引存在 且所有主分片处于活动状态。仅在`wait_for_advance`为true时可用。
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- msearch(*, searches=None, body=None, index=None, allow_no_indices=None, allow_partial_search_results=None, ccs_minimize_roundtrips=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_throttled=None, ignore_unavailable=None, max_concurrent_searches=None, max_concurrent_shard_requests=None, pre_filter_shard_size=None, pretty=None, rest_total_hits_as_int=None, search_type=None, typed_keys=None, wait_for_checkpoints=None)
执行多个Fleet搜索。 通过单个API请求执行多个Fleet搜索。 该API遵循与多搜索API相同的结构。 但与Fleet搜索API类似,它支持
wait_for_checkpoints
参数。https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-fleet-msearch
- Parameters:
index (str | None) – 单个搜索目标。如果目标是索引别名,则 必须解析为单个索引。
allow_no_indices (bool | None) – 如果为false,当任何通配符表达式、 索引别名或_all值仅指向缺失或关闭的索引时,请求将返回错误。 即使请求针对其他打开的索引,此行为也适用。例如, 针对foo*,bar*的请求如果存在以foo开头的索引但没有以bar 开头的索引,则会返回错误。
allow_partial_search_results (bool | None) – 如果为true,当存在分片请求 超时或分片失败时返回部分结果。如果为false,则返回错误且 不包含部分结果。默认为集群配置`search.default_allow_partial_results`, 默认值为true。
ccs_minimize_roundtrips (bool | None) – 如果为true,对于跨集群搜索请求, 协调节点与远程集群之间的网络往返将被最小化。
expand_wildcards (Sequence[str | Literal['all', 'closed', 'hidden', 'none', 'open']] | str | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | None) – 通配符表达式可匹配的索引类型。如果 请求可以针对数据流,此参数决定通配符表达式是否匹配 隐藏的数据流。
ignore_throttled (bool | None) – 如果为true,冻结的具体索引、扩展索引 或别名索引将被忽略。
ignore_unavailable (bool | None) – 如果为true,响应中不包含缺失或关闭的索引。
max_concurrent_searches (int | None) – 多搜索API可执行的最大并发搜索数。
max_concurrent_shard_requests (int | None) – 每个子搜索请求在每个节点上 执行的最大并发分片请求数。
pre_filter_shard_size (int | None) – 定义一个阈值,如果搜索请求扩展到的 分片数超过该阈值,则强制执行预过滤往返以基于查询重写预过滤 搜索分片。如果分片基于其重写方法无法匹配任何文档(例如,如果 日期过滤器是必需的但分片边界与查询不相交),此过滤往返可以 显著限制分片数量。
rest_total_hits_as_int (bool | None) – 如果为true,hits.total在响应中作为整数 返回。默认为false,返回对象形式。
search_type (str | Literal['dfs_query_then_fetch', 'query_then_fetch'] | None) – 指示在评分返回文档时是否应使用全局词项和文档频率。
typed_keys (bool | None) – 指定聚合和建议器名称是否应在响应中以其各自类型为前缀。
wait_for_checkpoints (Sequence[int] | None) – 以逗号分隔的检查点列表。当配置时, 搜索API将仅在相关检查点对搜索可见后在分片上执行。默认为空列表, 这将导致Elasticsearch立即执行搜索。
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- search(*, index, aggregations=None, aggs=None, allow_no_indices=None, allow_partial_search_results=None, analyze_wildcard=None, analyzer=None, batched_reduce_size=None, ccs_minimize_roundtrips=None, collapse=None, default_operator=None, df=None, docvalue_fields=None, error_trace=None, expand_wildcards=None, explain=None, ext=None, fields=None, filter_path=None, from_=None, highlight=None, human=None, ignore_throttled=None, ignore_unavailable=None, indices_boost=None, lenient=None, max_concurrent_shard_requests=None, min_score=None, pit=None, post_filter=None, pre_filter_shard_size=None, preference=None, pretty=None, profile=None, q=None, query=None, request_cache=None, rescore=None, rest_total_hits_as_int=None, routing=None, runtime_mappings=None, script_fields=None, scroll=None, search_after=None, search_type=None, seq_no_primary_term=None, size=None, slice=None, sort=None, source=None, source_excludes=None, source_includes=None, stats=None, stored_fields=None, suggest=None, suggest_field=None, suggest_mode=None, suggest_size=None, suggest_text=None, terminate_after=None, timeout=None, track_scores=None, track_total_hits=None, typed_keys=None, version=None, wait_for_checkpoints=None, body=None)
执行Fleet搜索。 Fleet搜索API的目的是提供一个API,该API仅在提供的检查点 被处理并对Elasticsearch内的搜索可见后才会执行搜索。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-fleet-search
- Parameters:
index (str) – 单个搜索目标。如果目标是索引别名,则 必须解析为单个索引。
allow_no_indices (bool | None)
allow_partial_search_results (bool | None) – 如果为true,当存在分片请求 超时或分片失败时返回部分结果。如果为false,则返回错误且 不包含部分结果。默认为集群配置`search.default_allow_partial_results`, 默认值为true。
analyze_wildcard (bool | None)
analyzer (str | None)
batched_reduce_size (int | None)
ccs_minimize_roundtrips (bool | None)
df (str | None)
docvalue_fields (Sequence[Mapping[str, Any]] | None) – 通配符(*)模式数组。请求返回字段名匹配 这些模式的文档值,位于响应的hits.fields属性中。
expand_wildcards (Sequence[str | Literal['all', 'closed', 'hidden', 'none', 'open']] | str | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | None)
explain (bool | None) – 如果为true,返回命中结果中关于分数计算的详细信息。
fields (Sequence[Mapping[str, Any]] | None) – 通配符(*)模式数组。请求返回字段名匹配 这些模式的值,位于响应的hits.fields属性中。
from – 起始文档偏移量。默认情况下,使用from和size参数 无法分页超过10,000个命中结果。要分页更多命中结果,请使用 search_after参数。
ignore_throttled (bool | None)
ignore_unavailable (bool | None)
indices_boost (Sequence[Mapping[str, float]] | None) – 提升指定索引文档的_score。
lenient (bool | None)
max_concurrent_shard_requests (int | None)
min_score (float | None) – 匹配文档的最低_score。低于此_score的文档 不会包含在搜索结果和聚合收集的结果中。
pit (Mapping[str, Any] | None) – 将搜索限制到某个时间点(PIT)。如果提供PIT, 则不能在请求路径中指定<index>。
pre_filter_shard_size (int | None)
preference (str | None)
profile (bool | None)
q (str | None)
request_cache (bool | None)
rescore (Mapping[str, Any] | Sequence[Mapping[str, Any]] | None)
rest_total_hits_as_int (bool | None)
routing (str | None)
runtime_mappings (Mapping[str, Mapping[str, Any]] | None) – 在搜索请求中定义一个或多个运行时字段。 这些字段优先于同名的映射字段。
script_fields (Mapping[str, Mapping[str, Any]] | None) – 为每个命中检索(基于不同字段的)脚本评估。
search_after (Sequence[None | bool | float | int | str] | None)
search_type (str | Literal['dfs_query_then_fetch', 'query_then_fetch'] | None)
seq_no_primary_term (bool | None) – 如果为true,返回每个命中最后修改的 序列号和主项。参见乐观并发控制。
size (int | None) – 返回的命中数。默认情况下,使用from和size参数 无法分页超过10,000个命中结果。要分页更多命中结果,请使用 search_after参数。
sort (Sequence[str | Mapping[str, Any]] | str | Mapping[str, Any] | None)
source (bool | Mapping[str, Any] | None) – 指示返回匹配文档的哪些源字段。 这些字段位于搜索响应的hits._source属性中。
stats (Sequence[str] | None) – 与搜索关联的统计组。每个组为其关联的搜索 维护统计聚合。可以使用索引统计API检索这些统计信息。
stored_fields (str | Sequence[str] | None) – 作为命中结果一部分返回的存储字段列表。如果未 指定字段,则响应中不包含存储字段。如果指定此字段,则_source参数 默认为false。可以传递_source: true以在搜索响应中同时返回源字段 和存储字段。
suggest_field (str | None) – 指定用于建议的字段。
suggest_mode (str | Literal['always', 'missing', 'popular'] | None)
suggest_size (int | None)
suggest_text (str | None) – 应返回建议的源文本。
terminate_after (int | None) – 每个分片收集的最大文档数。 如果查询达到此限制,Elasticsearch将提前终止查询。 Elasticsearch在排序前收集文档。默认为0,不提前终止查询执行。
timeout (str | None) – 指定等待每个分片响应的超时时间。如果在超时 到期前未收到响应,则请求失败并返回错误。默认为无超时。
track_scores (bool | None) – 如果为true,计算并返回文档分数,即使分数 不用于排序。
track_total_hits (bool | int | None) – 准确计数匹配查询的命中数。 如果为true,以性能为代价返回精确的命中数。 如果为false,响应不包含匹配查询的总命中数。默认为10,000个命中。
typed_keys (bool | None)
version (bool | None) – 如果为true,返回命中结果中的文档版本。
wait_for_checkpoints (Sequence[int] | None) – 以逗号分隔的检查点列表。当配置时, 搜索API将仅在相关检查点对搜索可见后在分片上执行。默认为空列表, 这将导致Elasticsearch立即执行搜索。
error_trace (bool | None)
from_ (int | None)
human (bool | None)
pretty (bool | None)
- Return type: