# Fleet

class elasticsearch.client.FleetClient

  To use this client, access `client.fleet` from an `Elasticsearch` 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)

    Get global checkpoints.

    Get the current global checkpoints for an index. This API is designed for internal use by the Fleet server project.

    https://www.elastic.co/docs/api/doc/elasticsearch/v9/group/endpoint-fleet

    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)

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

      - human (bool | None)

      - pretty (bool | None)

    Return type:

      ObjectApiResponse[Any]

  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)

    Run multiple Fleet searches.

    Run several Fleet searches with a single API request. The API follows the same structure as the multi search API. However, similar to the Fleet search API, it supports the `wait_for_checkpoints` parameter.

    https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation-fleet-msearch

    Parameters:

      - searches (Sequence[Mapping[str, Any]] | None)

      - 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) – A setting that does two separate checks on the index expression. If false, the request returns an error (1) if any wildcard expression (including _all and *) resolves to zero matching indices or (2) if the complete set of resolved indices, aliases or data streams is empty after all expressions are evaluated. If true, index expressions that resolve to no indices are allowed and the request returns an empty result.

      - allow_partial_search_results (bool | None) – If true, returns partial results if there are shard request timeouts or 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 false, the request returns an error if it targets a concrete (non-wildcarded) index, alias, or data stream that is missing, closed, or otherwise unavailable. If true, unavailable concrete targets are silently ignored.

      - 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.

      - body (Sequence[Mapping[str, Any]] | None)

      - error_trace (bool | None)

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

      - human (bool | None)

      - pretty (bool | None)

    Return type:

      ObjectApiResponse[Any]

  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)

    Run a Fleet search.

    The purpose of the Fleet search API is to provide an API where the search will be run only after the provided checkpoint has been processed and is visible for searches inside of Elasticsearch.

    https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation-fleet-search

    Parameters:

      - index (str) – A single target to search. If the target is an index alias, it must resolve to a single index.

      - aggregations (Mapping[str, Mapping[str, Any]] | None)

      - aggs (Mapping[str, Mapping[str, Any]] | None)

      - allow_no_indices (bool | None) – A setting that does two separate checks on the index expression. If false, the request returns an error (1) if any wildcard expression (including _all and *) resolves to zero matching indices or (2) if the complete set of resolved indices, aliases or data streams is empty after all expressions are evaluated. If true, index expressions that resolve to no indices are allowed and the request returns an empty result.

      - allow_partial_search_results (bool | None) – If true, returns partial results if there are shard request timeouts or 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)

      - collapse (Mapping[str, Any] | None)

      - default_operator (str | Literal['and', 'or'] | 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.

      - highlight (Mapping[str, Any] | None)

      - ignore_throttled (bool | None)

      - ignore_unavailable (bool | None) – If false, the request returns an error if it targets a concrete (non-wildcarded) index, alias, or data stream that is missing, closed, or otherwise unavailable. If true, unavailable concrete targets are silently ignored.

      - 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_score (float | None) – Minimum _score for matching documents. Documents with a lower _score are not included in search results and results collected by aggregations.

      - 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.

      - post_filter (Mapping[str, Any] | None)

      - 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 | Sequence[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.

      - scroll (str | Literal[-1] | ~typing.Literal[0] | 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) – 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.

      - slice (Mapping[str, Any] | None)

      - 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.

      - source_excludes (str | Sequence[str] | None)

      - source_includes (str | Sequence[str] | None)

      - 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 (Mapping[str, Any] | None)

      - 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)

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

      - from_ (int | None)

      - human (bool | None)

      - pretty (bool | None)

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

    Return type:

      ObjectApiResponse[Any]