Fleet
- class elasticsearch.client.FleetClient(client)
- Parameters:
client (BaseClient)
- 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)
Returns the current global checkpoints for an index. This API is design for internal use by the fleet server project.
https://www.elastic.co/guide/en/elasticsearch/reference/8.16/get-global-checkpoints.html
- Parameters:
index (str) – A single index or index alias that resolves to a single index.
checkpoints (Sequence[int] | None) – A comma separated list of previous global checkpoints. When used in combination with wait_for_advance, the API will only return once the global checkpoints advances past the checkpoints. Providing an empty list will cause Elasticsearch to immediately return the current global checkpoints.
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – Period to wait for a global checkpoints to advance past checkpoints.
wait_for_advance (bool | None) – A boolean value which controls whether to wait (until the timeout) for the global checkpoints to advance past the provided checkpoints.
wait_for_index (bool | None) – A boolean value which controls whether to wait (until the timeout) for the target index to exist and all primary shards be active. Can only be true when wait_for_advance is 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)
Executes several [fleet searches](https://www.elastic.co/guide/en/elasticsearch/reference/current/fleet-search.html) with a single API request. The API follows the same structure as the [multi search](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html) API. However, similar to the fleet search API, it supports the wait_for_checkpoints parameter.
- Parameters:
index (str | None) – A single target to search. If the target is an index alias, it must resolve to a single index.
allow_no_indices (bool | None) – If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar.
allow_partial_search_results (bool | None) – If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns an error with no partial results. Defaults to the configured cluster setting search.default_allow_partial_results which is true by default.
ccs_minimize_roundtrips (bool | None) – If true, network roundtrips between the coordinating node and remote clusters are minimized for cross-cluster search requests.
expand_wildcards (Sequence[str | Literal['all', 'closed', 'hidden', 'none', 'open']] | str | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | None) – Type of index that wildcard expressions can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.
ignore_throttled (bool | None) – If true, concrete, expanded or aliased indices are ignored when frozen.
ignore_unavailable (bool | None) – If true, missing or closed indices are not included in the response.
max_concurrent_searches (int | None) – Maximum number of concurrent searches the multi search API can execute.
max_concurrent_shard_requests (int | None) – Maximum number of concurrent shard requests that each sub-search request executes per node.
pre_filter_shard_size (int | None) – Defines a threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method i.e., if date filters are mandatory to match but the shard bounds and the query are disjoint.
rest_total_hits_as_int (bool | None) – If true, hits.total are returned as an integer in the response. Defaults to false, which returns an object.
search_type (str | Literal['dfs_query_then_fetch', 'query_then_fetch'] | None) – Indicates whether global term and document frequencies should be used when scoring returned documents.
typed_keys (bool | None) – Specifies whether aggregation and suggester names should be prefixed by their respective types in the response.
wait_for_checkpoints (Sequence[int] | None) – A comma separated list of checkpoints. When configured, the search API will only be executed on a shard after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause Elasticsearch to immediately execute the search.
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_compatible_shard_node=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)
The purpose of the fleet search api is to provide a search api where the search will only be executed after provided checkpoint has been processed and is visible for searches inside of Elasticsearch.
- Parameters:
index (str) – A single target to search. If the target is an index alias, it must resolve to a single index.
allow_no_indices (bool | None)
allow_partial_search_results (bool | None) – If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns an error with no partial results. Defaults to the configured cluster setting search.default_allow_partial_results which is true by default.
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) – Array of wildcard (*) patterns. The request returns doc values for field names matching these patterns in the hits.fields property of the response.
expand_wildcards (Sequence[str | Literal['all', 'closed', 'hidden', 'none', 'open']] | str | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | None)
explain (bool | None) – If true, returns detailed information about score computation as part of a hit.
ext (Mapping[str, Any] | None) – Configuration of search extensions defined by Elasticsearch plugins.
fields (Sequence[Mapping[str, Any]] | None) – Array of wildcard (*) patterns. The request returns values for field names matching these patterns in the hits.fields property of the response.
from – Starting document offset. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter.
ignore_throttled (bool | None)
ignore_unavailable (bool | None)
indices_boost (Sequence[Mapping[str, float]] | None) – Boosts the _score of documents from specified indices.
lenient (bool | None)
max_concurrent_shard_requests (int | None)
min_compatible_shard_node (str | None)
min_score (float | None) – Minimum _score for matching documents. Documents with a lower _score are not included in the search results.
pit (Mapping[str, Any] | None) – Limits the search to a point in time (PIT). If you provide a PIT, you cannot specify an <index> in the request path.
pre_filter_shard_size (int | None)
preference (str | None)
profile (bool | None)
q (str | None)
query (Mapping[str, Any] | None) – Defines the search definition using the Query DSL.
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) – Defines one or more runtime fields in the search request. These fields take precedence over mapped fields with the same name.
script_fields (Mapping[str, Mapping[str, Any]] | None) – Retrieve a script evaluation (based on different fields) for each hit.
search_after (Sequence[None | bool | float | int | str | Any] | None)
search_type (str | Literal['dfs_query_then_fetch', 'query_then_fetch'] | None)
seq_no_primary_term (bool | None) – If true, returns sequence number and primary term of the last modification of each hit. See Optimistic concurrency control.
size (int | None) – The number of hits to return. By default, you cannot page through more than 10,000 hits using the from and size parameters. To page through more hits, use the search_after parameter.
sort (Sequence[str | Mapping[str, Any]] | str | Mapping[str, Any] | None)
source (bool | Mapping[str, Any] | None) – Indicates which source fields are returned for matching documents. These fields are returned in the hits._source property of the search response.
stats (Sequence[str] | None) – Stats groups to associate with the search. Each group maintains a statistics aggregation for its associated searches. You can retrieve these stats using the indices stats API.
stored_fields (str | Sequence[str] | None) – List of stored fields to return as part of a hit. If no fields are specified, no stored fields are included in the response. If this field is specified, the _source parameter defaults to false. You can pass _source: true to return both source fields and stored fields in the search response.
suggest_field (str | None) – Specifies which field to use for suggestions.
suggest_mode (str | Literal['always', 'missing', 'popular'] | None)
suggest_size (int | None)
suggest_text (str | None) – The source text for which the suggestions should be returned.
terminate_after (int | None) – Maximum number of documents to collect for each shard. If a query reaches this limit, Elasticsearch terminates the query early. Elasticsearch collects documents before sorting. Defaults to 0, which does not terminate query execution early.
timeout (str | None) – Specifies the period of time to wait for a response from each shard. If no response is received before the timeout expires, the request fails and returns an error. Defaults to no timeout.
track_scores (bool | None) – If true, calculate and return document scores, even if the scores are not used for sorting.
track_total_hits (bool | int | None) – Number of hits matching the query to count accurately. If true, the exact number of hits is returned at the cost of some performance. If false, the response does not include the total number of hits matching the query. Defaults to 10,000 hits.
typed_keys (bool | None)
version (bool | None) – If true, returns document version as part of a hit.
wait_for_checkpoints (Sequence[int] | None) – A comma separated list of checkpoints. When configured, the search API will only be executed on a shard after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause Elasticsearch to immediately execute the search.
error_trace (bool | None)
from_ (int | None)
human (bool | None)
pretty (bool | None)
- Return type: