Elasticsearch API Reference

All the API calls map the raw REST API as closely as possible, including the distinction between required and optional arguments to the calls. Keyword arguments are required for all

Note

Some API parameters in Elasticsearch are reserved keywords in Python. For example the from query parameter for pagination would be aliased as from_.

Elasticsearch

class elasticsearch.Elasticsearch(hosts=None, *, cloud_id=None, api_key=None, basic_auth=None, bearer_auth=None, opaque_id=None, headers=DefaultType.value, connections_per_node=DefaultType.value, http_compress=DefaultType.value, verify_certs=DefaultType.value, ca_certs=DefaultType.value, client_cert=DefaultType.value, client_key=DefaultType.value, ssl_assert_hostname=DefaultType.value, ssl_assert_fingerprint=DefaultType.value, ssl_version=DefaultType.value, ssl_context=DefaultType.value, ssl_show_warn=DefaultType.value, transport_class=<class 'elastic_transport.Transport'>, request_timeout=DefaultType.value, node_class=DefaultType.value, node_pool_class=DefaultType.value, randomize_nodes_in_pool=DefaultType.value, node_selector_class=DefaultType.value, dead_node_backoff_factor=DefaultType.value, max_dead_node_backoff=DefaultType.value, serializer=None, serializers=DefaultType.value, default_mimetype='application/json', max_retries=DefaultType.value, retry_on_status=DefaultType.value, retry_on_timeout=DefaultType.value, sniff_on_start=DefaultType.value, sniff_before_requests=DefaultType.value, sniff_on_node_failure=DefaultType.value, sniff_timeout=DefaultType.value, min_delay_between_sniffing=DefaultType.value, sniffed_node_callback=None, meta_header=DefaultType.value, timeout=DefaultType.value, randomize_hosts=DefaultType.value, host_info_callback=None, sniffer_timeout=DefaultType.value, sniff_on_connection_fail=DefaultType.value, http_auth=DefaultType.value, maxsize=DefaultType.value, _transport=None)

Elasticsearch low-level client. Provides a straightforward mapping from Python to Elasticsearch REST APIs.

The client instance has additional attributes to update APIs in different namespaces such as async_search, indices, security, and more:

client = Elasticsearch("http://localhost:9200")

# Get Document API
client.get(index="*", id="1")

# Get Index API
client.indices.get(index="*")

Transport options can be set on the client constructor or using the options() method:

# Set 'api_key' on the constructor
client = Elasticsearch(
    "http://localhost:9200",
    api_key=("id", "api_key")
)
client.search(...)

# Set 'api_key' per request
client.options(api_key=("id", "api_key")).search(...)
Parameters:
bulk(*, operations, index=None, error_trace=None, filter_path=None, human=None, pipeline=None, pretty=None, refresh=None, require_alias=None, routing=None, source=None, source_excludes=None, source_includes=None, timeout=None, wait_for_active_shards=None)

Allows to perform multiple index/update/delete operations in a single request.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-bulk.html

Parameters:
  • operations (Sequence[Mapping[str, Any]]) –

  • index (str | None) – Default index for items which don’t provide one

  • pipeline (str | None) – The pipeline id to preprocess incoming documents with

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

  • require_alias (bool | None) – Sets require_alias for all incoming documents. Defaults to unset (false)

  • routing (str | None) – Specific routing value

  • source (bool | str | Sequence[str] | None) – True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request

  • source_excludes (str | Sequence[str] | None) – Default list of fields to exclude from the returned _source field, can be overridden on each sub-request

  • source_includes (str | Sequence[str] | None) – Default list of fields to extract and return from the _source field, can be overridden on each sub-request

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clear_scroll(*, error_trace=None, filter_path=None, human=None, pretty=None, scroll_id=None)

Explicitly clears the search context for a scroll.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/clear-scroll-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

close()

Closes the Transport and all internal connections

Return type:

None

close_point_in_time(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Close a point in time

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/point-in-time-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

count(*, index=None, allow_no_indices=None, analyze_wildcard=None, analyzer=None, default_operator=None, df=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_throttled=None, ignore_unavailable=None, lenient=None, min_score=None, preference=None, pretty=None, q=None, query=None, routing=None, terminate_after=None)

Returns number of documents matching a query.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-count.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of indices to restrict the results

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • analyze_wildcard (bool | None) – Specify whether wildcard and prefix queries should be analyzed (default: false)

  • analyzer (str | None) – The analyzer to use for the query string

  • default_operator (Literal['and', 'or'] | str | None) – The default operator for query string query (AND or OR)

  • df (str | None) – The field to use as default where no field prefix is given in the query string

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • ignore_throttled (bool | None) – Whether specified concrete, expanded or aliased indices should be ignored when throttled

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • lenient (bool | None) – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

  • min_score (float | None) – Include only documents with a specific _score value in the result

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • q (str | None) – Query in the Lucene query string syntax

  • query (Mapping[str, Any] | None) –

  • routing (str | None) – A comma-separated list of specific routing values

  • terminate_after (int | None) – The maximum count for each shard, upon reaching which the query execution will terminate early

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

create(*, index, id, document, error_trace=None, filter_path=None, human=None, pipeline=None, pretty=None, refresh=None, routing=None, timeout=None, version=None, version_type=None, wait_for_active_shards=None)

Creates a new document in the index. Returns a 409 response when a document with a same ID already exists in the index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-index_.html

Parameters:
  • index (str) – The name of the index

  • id (str) – Document ID

  • document (Mapping[str, Any]) –

  • pipeline (str | None) – The pipeline id to preprocess incoming documents with

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

  • routing (str | None) – Specific routing value

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • version (int | None) – Explicit version number for concurrency control

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete(*, index, id, error_trace=None, filter_path=None, human=None, if_primary_term=None, if_seq_no=None, pretty=None, refresh=None, routing=None, timeout=None, version=None, version_type=None, wait_for_active_shards=None)

Removes a document from the index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-delete.html

Parameters:
  • index (str) – The name of the index

  • id (str) – The document ID

  • if_primary_term (int | None) – only perform the delete operation if the last operation that has changed the document has the specified primary term

  • if_seq_no (int | None) – only perform the delete operation if the last operation that has changed the document has the specified sequence number

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

  • routing (str | None) – Specific routing value

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • version (int | None) – Explicit version number for concurrency control

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_by_query(*, index, allow_no_indices=None, analyze_wildcard=None, analyzer=None, conflicts=None, default_operator=None, df=None, error_trace=None, expand_wildcards=None, filter_path=None, from_=None, human=None, ignore_unavailable=None, lenient=None, max_docs=None, preference=None, pretty=None, q=None, query=None, refresh=None, request_cache=None, requests_per_second=None, routing=None, scroll=None, scroll_size=None, search_timeout=None, search_type=None, slice=None, slices=None, sort=None, stats=None, terminate_after=None, timeout=None, version=None, wait_for_active_shards=None, wait_for_completion=None)

Deletes documents matching the provided query.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-delete-by-query.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • analyze_wildcard (bool | None) – Specify whether wildcard and prefix queries should be analyzed (default: false)

  • analyzer (str | None) – The analyzer to use for the query string

  • conflicts (Literal['abort', 'proceed'] | str | None) – What to do when the delete by query hits version conflicts?

  • default_operator (Literal['and', 'or'] | str | None) – The default operator for query string query (AND or OR)

  • df (str | None) – The field to use as default where no field prefix is given in the query string

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • from – Starting offset (default: 0)

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • lenient (bool | None) – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

  • max_docs (int | None) –

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • q (str | None) – Query in the Lucene query string syntax

  • query (Mapping[str, Any] | None) –

  • refresh (bool | None) – Should the affected indexes be refreshed?

  • request_cache (bool | None) – Specify if request cache should be used for this request or not, defaults to index level setting

  • requests_per_second (float | None) – The throttle for this request in sub-requests per second. -1 means no throttle.

  • routing (str | None) – A comma-separated list of specific routing values

  • scroll (Literal[-1] | ~typing.Literal[0] | str | None) – Specify how long a consistent view of the index should be maintained for scrolled search

  • scroll_size (int | None) – Size on the scroll request powering the delete by query

  • search_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit timeout for each search request. Defaults to no timeout.

  • search_type (Literal['dfs_query_then_fetch', 'query_then_fetch'] | str | None) – Search operation type

  • slice (Mapping[str, Any] | None) –

  • slices (int | Literal['auto'] | str | None) – The number of slices this task should be divided into. Defaults to 1, meaning the task isn’t sliced into subtasks. Can be set to auto.

  • sort (Sequence[str] | None) – A comma-separated list of <field>:<direction> pairs

  • stats (Sequence[str] | None) – Specific ‘tag’ of the request for logging and statistical purposes

  • terminate_after (int | None) – The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Time each individual bulk request should wait for shards that are unavailable.

  • version (bool | None) – Specify whether to return document version as part of a hit

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • wait_for_completion (bool | None) – Should the request should block until the delete by query is complete.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_by_query_rethrottle(*, task_id, error_trace=None, filter_path=None, human=None, pretty=None, requests_per_second=None)

Changes the number of requests per second for a particular Delete By Query operation.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-delete-by-query.html

Parameters:
  • task_id (int | str) – The task id to rethrottle

  • requests_per_second (float | None) – The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_script(*, id, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes a script.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-scripting.html

Parameters:
  • id (str) – Script ID

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

exists(*, index, id, error_trace=None, filter_path=None, human=None, preference=None, pretty=None, realtime=None, refresh=None, routing=None, source=None, source_excludes=None, source_includes=None, stored_fields=None, version=None, version_type=None)

Returns information about whether a document exists in an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-get.html

Parameters:
  • index (str) – The name of the index

  • id (str) – The document ID

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • realtime (bool | None) – Specify whether to perform the operation in realtime or search mode

  • refresh (bool | None) – Refresh the shard containing the document before performing the operation

  • routing (str | None) – Specific routing value

  • source (bool | str | Sequence[str] | None) – True or false to return the _source field or not, or a list of fields to return

  • source_excludes (str | Sequence[str] | None) – A list of fields to exclude from the returned _source field

  • source_includes (str | Sequence[str] | None) – A list of fields to extract and return from the _source field

  • stored_fields (str | Sequence[str] | None) – A comma-separated list of stored fields to return in the response

  • version (int | None) – Explicit version number for concurrency control

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

HeadApiResponse

exists_source(*, index, id, error_trace=None, filter_path=None, human=None, preference=None, pretty=None, realtime=None, refresh=None, routing=None, source=None, source_excludes=None, source_includes=None, version=None, version_type=None)

Returns information about whether a document source exists in an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-get.html

Parameters:
  • index (str) – The name of the index

  • id (str) – The document ID

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • realtime (bool | None) – Specify whether to perform the operation in realtime or search mode

  • refresh (bool | None) – Refresh the shard containing the document before performing the operation

  • routing (str | None) – Specific routing value

  • source (bool | str | Sequence[str] | None) – True or false to return the _source field or not, or a list of fields to return

  • source_excludes (str | Sequence[str] | None) – A list of fields to exclude from the returned _source field

  • source_includes (str | Sequence[str] | None) – A list of fields to extract and return from the _source field

  • version (int | None) – Explicit version number for concurrency control

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

HeadApiResponse

explain(*, index, id, analyze_wildcard=None, analyzer=None, default_operator=None, df=None, error_trace=None, filter_path=None, human=None, lenient=None, preference=None, pretty=None, q=None, query=None, routing=None, source=None, source_excludes=None, source_includes=None, stored_fields=None)

Returns information about why a specific matches (or doesn’t match) a query.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-explain.html

Parameters:
  • index (str) – The name of the index

  • id (str) – The document ID

  • analyze_wildcard (bool | None) – Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false)

  • analyzer (str | None) – The analyzer for the query string query

  • default_operator (Literal['and', 'or'] | str | None) – The default operator for query string query (AND or OR)

  • df (str | None) – The default field for query string query (default: _all)

  • lenient (bool | None) – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • q (str | None) – Query in the Lucene query string syntax

  • query (Mapping[str, Any] | None) –

  • routing (str | None) – Specific routing value

  • source (bool | str | Sequence[str] | None) – True or false to return the _source field or not, or a list of fields to return

  • source_excludes (str | Sequence[str] | None) – A list of fields to exclude from the returned _source field

  • source_includes (str | Sequence[str] | None) – A list of fields to extract and return from the _source field

  • stored_fields (str | Sequence[str] | None) – A comma-separated list of stored fields to return in the response

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

field_caps(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, fields=None, filter_path=None, filters=None, human=None, ignore_unavailable=None, include_unmapped=None, index_filter=None, pretty=None, runtime_mappings=None, types=None)

Returns the information about the capabilities of fields among multiple indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-field-caps.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden.

  • fields (str | Sequence[str] | None) – List of fields to retrieve capabilities for. Wildcard (*) expressions are supported.

  • filters (str | None) – An optional set of filters: can include +metadata,-metadata,-nested,-multifield,-parent

  • ignore_unavailable (bool | None) – If true, missing or closed indices are not included in the response.

  • include_unmapped (bool | None) – If true, unmapped fields are included in the response.

  • index_filter (Mapping[str, Any] | None) – Allows to filter indices if the provided query rewrites to match_none on every shard.

  • runtime_mappings (Mapping[str, Mapping[str, Any]] | None) – Defines ad-hoc runtime fields in the request similar to the way it is done in search requests. These fields exist only as part of the query and take precedence over fields defined with the same name in the index mappings.

  • types (Sequence[str] | None) – Only return results for fields that have one of the types in the list

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get(*, index, id, error_trace=None, filter_path=None, human=None, preference=None, pretty=None, realtime=None, refresh=None, routing=None, source=None, source_excludes=None, source_includes=None, stored_fields=None, version=None, version_type=None)

Returns a document.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-get.html

Parameters:
  • index (str) – Name of the index that contains the document.

  • id (str) – Unique identifier of the document.

  • preference (str | None) – Specifies the node or shard the operation should be performed on. Random by default.

  • realtime (bool | None) – Boolean) If true, the request is real-time as opposed to near-real-time.

  • refresh (bool | None) – If true, Elasticsearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes.

  • routing (str | None) – Target the specified primary shard.

  • source (bool | str | Sequence[str] | None) – True or false to return the _source field or not, or a list of fields to return.

  • source_excludes (str | Sequence[str] | None) – A comma-separated list of source fields to exclude in the response.

  • source_includes (str | Sequence[str] | None) – A comma-separated list of source fields to include in the response.

  • stored_fields (str | Sequence[str] | None) – A comma-separated list of stored fields to return in the response

  • version (int | None) – Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type: internal, external, external_gte.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_script(*, id, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)

Returns a script.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-scripting.html

Parameters:
  • id (str) – Script ID

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_script_context(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns all script contexts.

https://www.elastic.co/guide/en/elasticsearch/painless/8.10/painless-contexts.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_script_languages(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns available script types, languages and contexts

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-scripting.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_source(*, index, id, error_trace=None, filter_path=None, human=None, preference=None, pretty=None, realtime=None, refresh=None, routing=None, source=None, source_excludes=None, source_includes=None, stored_fields=None, version=None, version_type=None)

Returns the source of a document.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-get.html

Parameters:
  • index (str) – Name of the index that contains the document.

  • id (str) – Unique identifier of the document.

  • preference (str | None) – Specifies the node or shard the operation should be performed on. Random by default.

  • realtime (bool | None) – Boolean) If true, the request is real-time as opposed to near-real-time.

  • refresh (bool | None) – If true, Elasticsearch refreshes the affected shards to make this operation visible to search. If false, do nothing with refreshes.

  • routing (str | None) – Target the specified primary shard.

  • source (bool | str | Sequence[str] | None) – True or false to return the _source field or not, or a list of fields to return.

  • source_excludes (str | Sequence[str] | None) – A comma-separated list of source fields to exclude in the response.

  • source_includes (str | Sequence[str] | None) – A comma-separated list of source fields to include in the response.

  • stored_fields (str | Sequence[str] | None) –

  • version (int | None) – Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type: internal, external, external_gte.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

health_report(*, feature=None, error_trace=None, filter_path=None, human=None, pretty=None, size=None, timeout=None, verbose=None)

Returns the health of the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/health-api.html

Parameters:
  • feature (str | Sequence[str] | None) – A feature of the cluster, as returned by the top-level health report API.

  • size (int | None) – Limit the number of affected resources the health report API returns.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout.

  • verbose (bool | None) – Opt-in for more information about the health of the system.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

index(*, index, document, id=None, error_trace=None, filter_path=None, human=None, if_primary_term=None, if_seq_no=None, op_type=None, pipeline=None, pretty=None, refresh=None, require_alias=None, routing=None, timeout=None, version=None, version_type=None, wait_for_active_shards=None)

Creates or updates a document in an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-index_.html

Parameters:
  • index (str) – The name of the index

  • document (Mapping[str, Any]) –

  • id (str | None) – Document ID

  • if_primary_term (int | None) – only perform the index operation if the last operation that has changed the document has the specified primary term

  • if_seq_no (int | None) – only perform the index operation if the last operation that has changed the document has the specified sequence number

  • op_type (Literal['create', 'index'] | str | None) – Explicit operation type. Defaults to index for requests with an explicit document ID, and to `create`for requests without an explicit document ID

  • pipeline (str | None) – The pipeline id to preprocess incoming documents with

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false (the default) then do nothing with refreshes.

  • require_alias (bool | None) – When true, requires destination to be an alias. Default is false

  • routing (str | None) – Specific routing value

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • version (int | None) – Explicit version number for concurrency control

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

info(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns basic information about the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/index.html

Parameters:
Return type:

ObjectApiResponse[Any]

Performs a kNN search.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-search.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index names to search; use _all or to perform the operation on all indices

  • knn (Mapping[str, Any]) – kNN query to execute

  • docvalue_fields (Sequence[Mapping[str, Any]] | None) – The request returns doc values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.

  • fields (str | Sequence[str] | None) – The request returns values for field names matching these patterns in the hits.fields property of the response. Accepts wildcard (*) patterns.

  • filter (Mapping[str, Any] | Sequence[Mapping[str, Any]] | None) – Query to filter the documents that can match. The kNN search will return the top k documents that also match this filter. The value can be a single query or a list of queries. If filter isn’t provided, all documents are allowed to match.

  • routing (str | None) – A comma-separated list of specific routing values

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

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

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

mget(*, index=None, docs=None, error_trace=None, filter_path=None, human=None, ids=None, preference=None, pretty=None, realtime=None, refresh=None, routing=None, source=None, source_excludes=None, source_includes=None, stored_fields=None)

Allows to get multiple documents in one request.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-multi-get.html

Parameters:
  • index (str | None) – Name of the index to retrieve documents from when ids are specified, or when a document in the docs array does not specify an index.

  • docs (Sequence[Mapping[str, Any]] | None) – The documents you want to retrieve. Required if no index is specified in the request URI.

  • ids (str | Sequence[str] | None) – The IDs of the documents you want to retrieve. Allowed when the index is specified in the request URI.

  • preference (str | None) – Specifies the node or shard the operation should be performed on. Random by default.

  • realtime (bool | None) – If true, the request is real-time as opposed to near-real-time.

  • refresh (bool | None) – If true, the request refreshes relevant shards before retrieving documents.

  • routing (str | None) – Custom value used to route operations to a specific shard.

  • source (bool | str | Sequence[str] | None) – True or false to return the _source field or not, or a list of fields to return.

  • source_excludes (str | Sequence[str] | None) – A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter.

  • source_includes (str | Sequence[str] | None) – A comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. If the _source parameter is false, this parameter is ignored.

  • stored_fields (str | Sequence[str] | None) – If true, retrieves the document fields stored in the index rather than the document _source.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

msearch(*, searches, index=None, allow_no_indices=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, routing=None, search_type=None, typed_keys=None)

Allows to execute several search operations in one request.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-multi-search.html

Parameters:
  • searches (Sequence[Mapping[str, Any]]) –

  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and index aliases to search.

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

  • 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[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | 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.

  • routing (str | None) – Custom routing value used to route search operations to a specific shard.

  • search_type (Literal['dfs_query_then_fetch', 'query_then_fetch'] | str | 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.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

msearch_template(*, search_templates, index=None, ccs_minimize_roundtrips=None, error_trace=None, filter_path=None, human=None, max_concurrent_searches=None, pretty=None, rest_total_hits_as_int=None, search_type=None, typed_keys=None)

Allows to execute several search template operations in one request.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-multi-search.html

Parameters:
  • search_templates (Sequence[Mapping[str, Any]]) –

  • index (str | Sequence[str] | None) – A comma-separated list of index names to use as default

  • ccs_minimize_roundtrips (bool | None) – Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution

  • max_concurrent_searches (int | None) – Controls the maximum number of concurrent searches the multi search api will execute

  • rest_total_hits_as_int (bool | None) – Indicates whether hits.total should be rendered as an integer or an object in the rest search response

  • search_type (Literal['dfs_query_then_fetch', 'query_then_fetch'] | str | None) – Search operation type

  • typed_keys (bool | None) – Specify whether aggregation and suggester names should be prefixed by their respective types in the response

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

mtermvectors(*, index=None, docs=None, error_trace=None, field_statistics=None, fields=None, filter_path=None, human=None, ids=None, offsets=None, payloads=None, positions=None, preference=None, pretty=None, realtime=None, routing=None, term_statistics=None, version=None, version_type=None)

Returns multiple termvectors in one request.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-multi-termvectors.html

Parameters:
  • index (str | None) – The index in which the document resides.

  • docs (Sequence[Mapping[str, Any]] | None) –

  • field_statistics (bool | None) – Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”.

  • fields (str | Sequence[str] | None) – A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body “params” or “docs”.

  • ids (Sequence[str] | None) –

  • offsets (bool | None) – Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”.

  • payloads (bool | None) – Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”.

  • positions (bool | None) – Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”.

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body “params” or “docs”.

  • realtime (bool | None) – Specifies if requests are real-time as opposed to near-real-time (default: true).

  • routing (str | None) – Specific routing value. Applies to all returned documents unless otherwise specified in body “params” or “docs”.

  • term_statistics (bool | None) – Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body “params” or “docs”.

  • version (int | None) – Explicit version number for concurrency control

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

open_point_in_time(*, index, keep_alive, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, preference=None, pretty=None, routing=None)

Open a point in time that can be used in subsequent searches

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/point-in-time-api.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index names to open point in time; use _all or empty string to perform the operation on all indices

  • keep_alive (Literal[-1] | ~typing.Literal[0] | str) – Specific the time to live for the point in time

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • routing (str | None) – Specific routing value

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

ping(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns True if a successful response returns from the info() API, otherwise returns False. This API call can fail either at the transport layer (due to connection errors or timeouts) or from a non-2XX HTTP response (due to authentication or authorization issues).

If you want to discover why the request failed you should use the info() API.

https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html

Parameters:
  • error_trace (bool | None) –

  • filter_path (List[str] | str | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

bool

put_script(*, id, script, context=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Creates or updates a script.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-scripting.html

Parameters:
  • id (str) – Script ID

  • script (Mapping[str, Any]) –

  • context (str | None) – Script context

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

rank_eval(*, requests, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, metric=None, pretty=None, search_type=None)

Allows to evaluate the quality of ranked search results over a set of typical search queries

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-rank-eval.html

Parameters:
  • requests (Sequence[Mapping[str, Any]]) – A set of typical search requests, together with their provided ratings.

  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard (*) expressions are supported. To target all data streams and indices in a cluster, omit this parameter or use _all or *.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • ignore_unavailable (bool | None) – If true, missing or closed indices are not included in the response.

  • metric (Mapping[str, Any] | None) – Definition of the evaluation metric to calculate.

  • search_type (str | None) – Search operation type

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

reindex(*, dest, source, conflicts=None, error_trace=None, filter_path=None, human=None, max_docs=None, pretty=None, refresh=None, requests_per_second=None, require_alias=None, script=None, scroll=None, size=None, slices=None, timeout=None, wait_for_active_shards=None, wait_for_completion=None)

Allows to copy documents from one index to another, optionally filtering the source documents by a query, changing the destination index settings, or fetching the documents from a remote cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-reindex.html

Parameters:
  • dest (Mapping[str, Any]) –

  • source (Mapping[str, Any]) –

  • conflicts (Literal['abort', 'proceed'] | str | None) –

  • max_docs (int | None) –

  • refresh (bool | None) – Should the affected indexes be refreshed?

  • requests_per_second (float | None) – The throttle to set on this request in sub-requests per second. -1 means no throttle.

  • require_alias (bool | None) –

  • script (Mapping[str, Any] | None) –

  • scroll (Literal[-1] | ~typing.Literal[0] | str | None) – Control how long to keep the search context alive

  • size (int | None) –

  • slices (int | Literal['auto'] | str | None) – The number of slices this task should be divided into. Defaults to 1, meaning the task isn’t sliced into subtasks. Can be set to auto.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Time each individual bulk request should wait for shards that are unavailable.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • wait_for_completion (bool | None) – Should the request should block until the reindex is complete.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

reindex_rethrottle(*, task_id, error_trace=None, filter_path=None, human=None, pretty=None, requests_per_second=None)

Changes the number of requests per second for a particular Reindex operation.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-reindex.html

Parameters:
  • task_id (str) – The task id to rethrottle

  • requests_per_second (float | None) – The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

render_search_template(*, id=None, error_trace=None, file=None, filter_path=None, human=None, params=None, pretty=None, source=None)

Allows to use the Mustache language to pre-render a search definition.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/render-search-template-api.html

Parameters:
  • id (str | None) – The id of the stored search template

  • file (str | None) –

  • params (Mapping[str, Any] | None) –

  • source (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

scripts_painless_execute(*, context=None, context_setup=None, error_trace=None, filter_path=None, human=None, pretty=None, script=None)

Allows an arbitrary script to be executed and a result to be returned

https://www.elastic.co/guide/en/elasticsearch/painless/8.10/painless-execute-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

scroll(*, scroll_id, error_trace=None, filter_path=None, human=None, pretty=None, rest_total_hits_as_int=None, scroll=None)

Allows to retrieve a large numbers of results from a single search request.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-request-body.html#request-body-search-scroll

Parameters:
  • scroll_id (str) – Scroll ID of the search.

  • rest_total_hits_as_int (bool | None) – If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object.

  • scroll (Literal[-1] | ~typing.Literal[0] | str | None) – Period to retain the search context for scrolling.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

search(*, index=None, 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, knn=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, rank=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)

Returns results matching a query.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-search.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*). To search all data streams and indices, omit this parameter or use * or _all.

  • aggregations (Mapping[str, Mapping[str, Any]] | None) – Defines the aggregations that are run as part of the search request.

  • aggs (Mapping[str, Mapping[str, Any]] | None) – Defines the aggregations that are run as part of the search request.

  • 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. If false, returns an error with no partial results.

  • analyze_wildcard (bool | None) – If true, wildcard and prefix queries are analyzed. This parameter can only be used when the q query string parameter is specified.

  • analyzer (str | None) – Analyzer to use for the query string. This parameter can only be used when the q query string parameter is specified.

  • batched_reduce_size (int | None) – The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.

  • ccs_minimize_roundtrips (bool | None) – If true, network round-trips between the coordinating node and the remote clusters are minimized when executing cross-cluster search (CCS) requests.

  • collapse (Mapping[str, Any] | None) – Collapses search results the values of the specified field.

  • default_operator (Literal['and', 'or'] | str | None) – The default operator for query string query: AND or OR. This parameter can only be used when the q query string parameter is specified.

  • df (str | None) – Field to use as default where no field prefix is given in the query string. This parameter can only be used when the q query string parameter is specified.

  • 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[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden.

  • 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. Needs to be non-negative. 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) – Specifies the highlighter to use for retrieving highlighted snippets from one or more fields in your search results.

  • ignore_throttled (bool | None) – If true, concrete, expanded or aliased indices will be ignored when frozen.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • indices_boost (Sequence[Mapping[str, float]] | None) – Boosts the _score of documents from specified indices.

  • knn (Mapping[str, Any] | Sequence[Mapping[str, Any]] | None) – Defines the approximate kNN search to run.

  • lenient (bool | None) – If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. This parameter can only be used when the q query string parameter is specified.

  • max_concurrent_shard_requests (int | None) – Defines the number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests.

  • min_compatible_shard_node (str | None) – The minimum version of the node that can handle the request Any handling node with a lower version will fail the request.

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

  • post_filter (Mapping[str, Any] | None) – Use the post_filter parameter to filter search results. The search hits are filtered after the aggregations are calculated. A post filter has no impact on the aggregation results.

  • 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 (if date filters are mandatory to match but the shard bounds and the query are disjoint). When unspecified, the pre-filter phase is executed if any of these conditions is met: the request targets more than 128 shards; the request targets one or more read-only index; the primary sort of the query targets an indexed field.

  • preference (str | None) – Nodes and shards used for the search. By default, Elasticsearch selects from eligible nodes and shards using adaptive replica selection, accounting for allocation awareness. Valid values are: _only_local to run the search only on shards on the local node; _local to, if possible, run the search on shards on the local node, or if not, select shards using the default method; _only_nodes:<node-id>,<node-id> to run the search on only the specified nodes IDs, where, if suitable shards exist on more than one selected node, use shards on those nodes using the default method, or if none of the specified nodes are available, select shards from any available node using the default method; _prefer_nodes:<node-id>,<node-id> to if possible, run the search on the specified nodes IDs, or if not, select shards using the default method; _shards:<shard>,<shard> to run the search only on the specified shards; <custom-string> (any string that does not start with _) to route searches with the same <custom-string> to the same shards in the same order.

  • profile (bool | None) – Set to true to return detailed timing information about the execution of individual components in a search request. NOTE: This is a debugging tool and adds significant overhead to search execution.

  • q (str | None) – Query in the Lucene query string syntax using query parameter search. Query parameter searches do not support the full Elasticsearch Query DSL but are handy for testing.

  • query (Mapping[str, Any] | None) – Defines the search definition using the Query DSL.

  • rank (Mapping[str, Any] | None) – Defines the Reciprocal Rank Fusion (RRF) to use.

  • request_cache (bool | None) – If true, the caching of search results is enabled for requests where size is 0. Defaults to index level settings.

  • rescore (Mapping[str, Any] | Sequence[Mapping[str, Any]] | None) – Can be used to improve precision by reordering just the top (for example 100 - 500) documents returned by the query and post_filter phases.

  • rest_total_hits_as_int (bool | None) – Indicates whether hits.total should be rendered as an integer or an object in the rest search response.

  • routing (str | None) – Custom value used to route operations to a specific shard.

  • 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 (Literal[-1] | ~typing.Literal[0] | str | None) – Period to retain the search context for scrolling. See Scroll search results. By default, this value cannot exceed 1d (24 hours). You can change this limit using the search.max_keep_alive cluster-level setting.

  • search_after (Sequence[None | bool | float | int | str | Any] | None) – Used to retrieve the next page of hits using a set of sort values from the previous page.

  • search_type (Literal['dfs_query_then_fetch', 'query_then_fetch'] | str | None) – How distributed term frequencies are calculated for relevance scoring.

  • seq_no_primary_term (bool | None) – If true, returns sequence number and primary term of the last modification of each hit.

  • 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) – Can be used to split a scrolled search into multiple slices that can be consumed independently.

  • sort (Sequence[str | Mapping[str, Any]] | str | Mapping[str, Any] | None) – A comma-separated list of <field>:<direction> pairs.

  • 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) – A comma-separated list of source fields to exclude from the response. You can also use this parameter to exclude fields from the subset specified in _source_includes query parameter. If the _source parameter is false, this parameter is ignored.

  • source_includes (str | Sequence[str] | None) – A comma-separated list of source fields to include in the response. If this parameter is specified, only these source fields are returned. You can exclude fields from this subset using the _source_excludes query parameter. If the _source parameter is false, this parameter is ignored.

  • 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) – Defines a suggester that provides similar looking terms based on a provided text.

  • suggest_field (str | None) – Specifies which field to use for suggestions.

  • suggest_mode (Literal['always', 'missing', 'popular'] | str | None) – Specifies the suggest mode. This parameter can only be used when the suggest_field and suggest_text query string parameters are specified.

  • suggest_size (int | None) – Number of suggestions to return. This parameter can only be used when the suggest_field and suggest_text query string parameters are specified.

  • suggest_text (str | None) – The source text for which the suggestions should be returned. This parameter can only be used when the suggest_field and suggest_text query string parameters are specified.

  • 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. Use with caution. Elasticsearch applies this parameter to each shard handling the request. When possible, let Elasticsearch perform early termination automatically. Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. If set to 0 (default), the query does not terminate 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.

  • typed_keys (bool | None) – If true, aggregation and suggester names are be prefixed by their respective types in the response.

  • version (bool | None) – If true, returns document version as part of a hit.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

search_mvt(*, index, field, zoom, x, y, aggs=None, buffer=None, error_trace=None, exact_bounds=None, extent=None, fields=None, filter_path=None, grid_agg=None, grid_precision=None, grid_type=None, human=None, pretty=None, query=None, runtime_mappings=None, size=None, sort=None, track_total_hits=None, with_labels=None)

Searches a vector tile for geospatial values. Returns results as a binary Mapbox vector tile.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-vector-tile-api.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list of data streams, indices, or aliases to search

  • field (str) – Field containing geospatial data to return

  • zoom (int) – Zoom level for the vector tile to search

  • x (int) – X coordinate for the vector tile to search

  • y (int) – Y coordinate for the vector tile to search

  • aggs (Mapping[str, Mapping[str, Any]] | None) – Sub-aggregations for the geotile_grid. Supports the following aggregation types: - avg - cardinality - max - min - sum

  • buffer (int | None) – Size, in pixels, of a clipping buffer outside the tile. This allows renderers to avoid outline artifacts from geometries that extend past the extent of the tile.

  • exact_bounds (bool | None) – If false, the meta layer’s feature is the bounding box of the tile. If true, the meta layer’s feature is a bounding box resulting from a geo_bounds aggregation. The aggregation runs on <field> values that intersect the <zoom>/<x>/<y> tile with wrap_longitude set to false. The resulting bounding box may be larger than the vector tile.

  • extent (int | None) – Size, in pixels, of a side of the tile. Vector tiles are square with equal sides.

  • fields (str | Sequence[str] | None) – Fields to return in the hits layer. Supports wildcards (*). This parameter does not support fields with array values. Fields with array values may return inconsistent results.

  • grid_agg (Literal['geohex', 'geotile'] | str | None) – Aggregation used to create a grid for the field.

  • grid_precision (int | None) – Additional zoom levels available through the aggs layer. For example, if <zoom> is 7 and grid_precision is 8, you can zoom in up to level 15. Accepts 0-8. If 0, results don’t include the aggs layer.

  • grid_type (Literal['centroid', 'grid', 'point'] | str | None) – Determines the geometry type for features in the aggs layer. In the aggs layer, each feature represents a geotile_grid cell. If ‘grid’ each feature is a Polygon of the cells bounding box. If ‘point’ each feature is a Point that is the centroid of the cell.

  • query (Mapping[str, Any] | None) – Query DSL used to filter documents for the search.

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

  • size (int | None) – Maximum number of features to return in the hits layer. Accepts 0-10000. If 0, results don’t include the hits layer.

  • sort (Sequence[str | Mapping[str, Any]] | str | Mapping[str, Any] | None) – Sorts features in the hits layer. By default, the API calculates a bounding box for each feature. It sorts features based on this box’s diagonal length, from longest to shortest.

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

  • with_labels (bool | None) – If true, the hits and aggs layers will contain additional point features representing suggested label positions for the original features.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

BinaryApiResponse

search_shards(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, local=None, preference=None, pretty=None, routing=None)

Returns information about the indices and shards that a search request would be executed against.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-shards.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • local (bool | None) – Return local information, do not retrieve the state from master node (default: false)

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • routing (str | None) – Specific routing value

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

search_template(*, index=None, allow_no_indices=None, ccs_minimize_roundtrips=None, error_trace=None, expand_wildcards=None, explain=None, filter_path=None, human=None, id=None, ignore_throttled=None, ignore_unavailable=None, params=None, preference=None, pretty=None, profile=None, rest_total_hits_as_int=None, routing=None, scroll=None, search_type=None, source=None, typed_keys=None)

Allows to use the Mustache language to pre-render a search definition.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-template.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*).

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • ccs_minimize_roundtrips (bool | None) – Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • explain (bool | None) –

  • id (str | None) – ID of the search template to use. If no source is specified, this parameter is required.

  • ignore_throttled (bool | None) – Whether specified concrete, expanded or aliased indices should be ignored when throttled

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • params (Mapping[str, Any] | None) –

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • profile (bool | None) –

  • rest_total_hits_as_int (bool | None) – If true, hits.total are rendered as an integer in the response.

  • routing (str | None) – Custom value used to route operations to a specific shard.

  • scroll (Literal[-1] | ~typing.Literal[0] | str | None) – Specifies how long a consistent view of the index should be maintained for scrolled search.

  • search_type (Literal['dfs_query_then_fetch', 'query_then_fetch'] | str | None) – The type of the search operation.

  • source (str | None) – An inline search template. Supports the same parameters as the search API’s request body. Also supports Mustache variables. If no id is specified, this parameter is required.

  • typed_keys (bool | None) – Specify whether aggregation and suggester names should be prefixed by their respective types in the response

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

terms_enum(*, index, field, case_insensitive=None, error_trace=None, filter_path=None, human=None, index_filter=None, pretty=None, search_after=None, size=None, string=None, timeout=None)

The terms enum API can be used to discover terms in the index that begin with the provided string. It is designed for low-latency look-ups used in auto-complete scenarios.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-terms-enum.html

Parameters:
  • index (str) – Comma-separated list of data streams, indices, and index aliases to search. Wildcard (*) expressions are supported.

  • field (str) – The string to match at the start of indexed terms. If not provided, all terms in the field are considered.

  • case_insensitive (bool | None) – When true the provided search string is matched against index terms without case sensitivity.

  • index_filter (Mapping[str, Any] | None) – Allows to filter an index shard if the provided query rewrites to match_none.

  • search_after (str | None) –

  • size (int | None) – How many matching terms to return.

  • string (str | None) – The string after which terms in the index should be returned. Allows for a form of pagination if the last result from one request is passed as the search_after parameter for a subsequent request.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – The maximum length of time to spend collecting results. Defaults to “1s” (one second). If the timeout is exceeded the complete flag set to false in the response and the results may be partial or empty.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

termvectors(*, index, id=None, doc=None, error_trace=None, field_statistics=None, fields=None, filter=None, filter_path=None, human=None, offsets=None, payloads=None, per_field_analyzer=None, positions=None, preference=None, pretty=None, realtime=None, routing=None, term_statistics=None, version=None, version_type=None)

Returns information and statistics about terms in the fields of a particular document.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-termvectors.html

Parameters:
  • index (str) – The index in which the document resides.

  • id (str | None) – The id of the document, when not specified a doc param should be supplied.

  • doc (Mapping[str, Any] | None) –

  • field_statistics (bool | None) – Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.

  • fields (str | Sequence[str] | None) – A comma-separated list of fields to return.

  • filter (Mapping[str, Any] | None) –

  • offsets (bool | None) – Specifies if term offsets should be returned.

  • payloads (bool | None) – Specifies if term payloads should be returned.

  • per_field_analyzer (Mapping[str, str] | None) –

  • positions (bool | None) – Specifies if term positions should be returned.

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random).

  • realtime (bool | None) – Specifies if request is real-time as opposed to near-real-time (default: true).

  • routing (str | None) – Specific routing value.

  • term_statistics (bool | None) – Specifies if total term frequency and document frequency should be returned.

  • version (int | None) – Explicit version number for concurrency control

  • version_type (Literal['external', 'external_gte', 'force', 'internal'] | str | None) – Specific version type

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update(*, index, id, detect_noop=None, doc=None, doc_as_upsert=None, error_trace=None, filter_path=None, human=None, if_primary_term=None, if_seq_no=None, lang=None, pretty=None, refresh=None, require_alias=None, retry_on_conflict=None, routing=None, script=None, scripted_upsert=None, source=None, source_excludes=None, source_includes=None, timeout=None, upsert=None, wait_for_active_shards=None)

Updates a document with a script or partial document.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-update.html

Parameters:
  • index (str) – The name of the index

  • id (str) – Document ID

  • detect_noop (bool | None) – Set to false to disable setting ‘result’ in the response to ‘noop’ if no change to the document occurred.

  • doc (Mapping[str, Any] | None) – A partial update to an existing document.

  • doc_as_upsert (bool | None) – Set to true to use the contents of ‘doc’ as the value of ‘upsert’

  • if_primary_term (int | None) – Only perform the operation if the document has this primary term.

  • if_seq_no (int | None) – Only perform the operation if the document has this sequence number.

  • lang (str | None) – The script language.

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If ‘true’, Elasticsearch refreshes the affected shards to make this operation visible to search, if ‘wait_for’ then wait for a refresh to make this operation visible to search, if ‘false’ do nothing with refreshes.

  • require_alias (bool | None) – If true, the destination must be an index alias.

  • retry_on_conflict (int | None) – Specify how many times should the operation be retried when a conflict occurs.

  • routing (str | None) – Custom value used to route operations to a specific shard.

  • script (Mapping[str, Any] | None) – Script to execute to update the document.

  • scripted_upsert (bool | None) – Set to true to execute the script whether or not the document exists.

  • source (bool | Mapping[str, Any] | None) – Set to false to disable source retrieval. You can also specify a comma-separated list of the fields you want to retrieve.

  • source_excludes (str | Sequence[str] | None) – Specify the source fields you want to exclude.

  • source_includes (str | Sequence[str] | None) – Specify the source fields you want to retrieve.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for dynamic mapping updates and active shards. This guarantees Elasticsearch waits for at least the timeout before failing. The actual wait time could be longer, particularly when multiple waits occur.

  • upsert (Mapping[str, Any] | None) – If the document does not already exist, the contents of ‘upsert’ are inserted as a new document. If the document exists, the ‘script’ is executed.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operations. Set to ‘all’ or any positive integer up to the total number of shards in the index (number_of_replicas+1). Defaults to 1 meaning the primary shard.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_by_query(*, index, allow_no_indices=None, analyze_wildcard=None, analyzer=None, conflicts=None, default_operator=None, df=None, error_trace=None, expand_wildcards=None, filter_path=None, from_=None, human=None, ignore_unavailable=None, lenient=None, max_docs=None, pipeline=None, preference=None, pretty=None, query=None, refresh=None, request_cache=None, requests_per_second=None, routing=None, script=None, scroll=None, scroll_size=None, search_timeout=None, search_type=None, slice=None, slices=None, sort=None, stats=None, terminate_after=None, timeout=None, version=None, version_type=None, wait_for_active_shards=None, wait_for_completion=None)

Performs an update on every document in the index without changing the source, for example to pick up a mapping change.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-update-by-query.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index names to search; use _all or empty string to perform the operation on all indices

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • analyze_wildcard (bool | None) – Specify whether wildcard and prefix queries should be analyzed (default: false)

  • analyzer (str | None) – The analyzer to use for the query string

  • conflicts (Literal['abort', 'proceed'] | str | None) –

  • default_operator (Literal['and', 'or'] | str | None) – The default operator for query string query (AND or OR)

  • df (str | None) – The field to use as default where no field prefix is given in the query string

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • from – Starting offset (default: 0)

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • lenient (bool | None) – Specify whether format-based query failures (such as providing text to a numeric field) should be ignored

  • max_docs (int | None) –

  • pipeline (str | None) – Ingest pipeline to set on index requests made by this action. (default: none)

  • preference (str | None) – Specify the node or shard the operation should be performed on (default: random)

  • query (Mapping[str, Any] | None) –

  • refresh (bool | None) – Should the affected indexes be refreshed?

  • request_cache (bool | None) – Specify if request cache should be used for this request or not, defaults to index level setting

  • requests_per_second (float | None) – The throttle to set on this request in sub-requests per second. -1 means no throttle.

  • routing (str | None) – A comma-separated list of specific routing values

  • script (Mapping[str, Any] | None) –

  • scroll (Literal[-1] | ~typing.Literal[0] | str | None) – Specify how long a consistent view of the index should be maintained for scrolled search

  • scroll_size (int | None) – Size on the scroll request powering the update by query

  • search_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit timeout for each search request. Defaults to no timeout.

  • search_type (Literal['dfs_query_then_fetch', 'query_then_fetch'] | str | None) – Search operation type

  • slice (Mapping[str, Any] | None) –

  • slices (int | Literal['auto'] | str | None) – The number of slices this task should be divided into. Defaults to 1, meaning the task isn’t sliced into subtasks. Can be set to auto.

  • sort (Sequence[str] | None) – A comma-separated list of <field>:<direction> pairs

  • stats (Sequence[str] | None) – Specific ‘tag’ of the request for logging and statistical purposes

  • terminate_after (int | None) – The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Time each individual bulk request should wait for shards that are unavailable.

  • version (bool | None) – Specify whether to return document version as part of a hit

  • version_type (bool | None) – Should the document increment the version number (internal) on hit or not (reindex)

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • wait_for_completion (bool | None) – Should the request should block until the update by query operation is complete.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_by_query_rethrottle(*, task_id, error_trace=None, filter_path=None, human=None, pretty=None, requests_per_second=None)

Changes the number of requests per second for a particular Update By Query operation.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/docs-update-by-query.html

Parameters:
  • task_id (str) – The task id to rethrottle

  • requests_per_second (float | None) – The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Autoscaling

class elasticsearch.client.AutoscalingClient(client)
Parameters:

client (BaseClient) –

delete_autoscaling_policy(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/autoscaling-delete-autoscaling-policy.html

Parameters:
  • name (str) – the name of the autoscaling policy

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_autoscaling_capacity(*, error_trace=None, filter_path=None, human=None, pretty=None)

Gets the current autoscaling capacity based on the configured autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/autoscaling-get-autoscaling-capacity.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_autoscaling_policy(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves an autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/autoscaling-get-autoscaling-capacity.html

Parameters:
  • name (str) – the name of the autoscaling policy

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_autoscaling_policy(*, name, policy, error_trace=None, filter_path=None, human=None, pretty=None)

Creates a new autoscaling policy. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/autoscaling-put-autoscaling-policy.html

Parameters:
Return type:

ObjectApiResponse[Any]

Cat

class elasticsearch.client.CatClient(client)
Parameters:

client (BaseClient) –

aliases(*, name=None, error_trace=None, expand_wildcards=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Shows information about currently configured aliases to indices including filter and routing infos.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-alias.html

Parameters:
  • name (str | Sequence[str] | None) – A comma-separated list of aliases to retrieve. Supports wildcards (*). To retrieve all aliases, omit this parameter or use * or _all.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

allocation(*, node_id=None, bytes=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-allocation.html

Parameters:
  • node_id (str | Sequence[str] | None) – Comma-separated list of node identifiers or names used to limit the returned information.

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

component_templates(*, name=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns information about existing component_templates templates.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-component-templates.html

Parameters:
  • name (str | None) – The name of the component template. Accepts wildcard expressions. If omitted, all component templates are returned.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

count(*, index=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Provides quick access to the document count of the entire cluster, or individual indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-count.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

fielddata(*, fields=None, bytes=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Shows how much heap memory is currently being used by fielddata on every data node in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-fielddata.html

Parameters:
  • fields (str | Sequence[str] | None) – Comma-separated list of fields used to limit returned information. To retrieve all fields, omit this parameter.

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

health(*, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, time=None, ts=None, v=None)

Returns a concise representation of the cluster health.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-health.html

Parameters:
  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • time (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – The unit used to display time values.

  • ts (bool | None) – If true, returns HH:MM:SS and Unix epoch timestamps.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

help(*, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns help for the Cat APIs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat.html

Parameters:
  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

TextApiResponse

indices(*, index=None, bytes=None, error_trace=None, expand_wildcards=None, filter_path=None, format=None, h=None, health=None, help=None, human=None, include_unloaded_segments=None, local=None, master_timeout=None, pretty=None, pri=None, s=None, time=None, v=None)

Returns information about indices: number of primaries and replicas, document counts, disk size, …

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-indices.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – The type of index that wildcard patterns can match.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • health (Literal['green', 'red', 'yellow'] | str | None) – The health status used to limit returned indices. By default, the response includes indices of any health status.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • include_unloaded_segments (bool | None) – If true, the response includes information from segments that are not loaded into memory.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • pri (bool | None) – If true, the response only includes information from primary shards.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • time (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – The unit used to display time values.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

master(*, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns information about the master node.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-master.html

Parameters:
  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

ml_data_frame_analytics(*, id=None, allow_no_match=None, bytes=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, time=None, v=None)

Gets configuration and usage information about data frame analytics jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-dfanalytics.html

Parameters:
  • id (str | None) – The ID of the data frame analytics to fetch

  • allow_no_match (bool | None) – Whether to ignore if a wildcard expression matches no configs. (This includes _all string or when no configs have been specified)

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit in which to display byte values

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (Sequence[Literal['assignment_explanation', 'create_time', 'description', 'dest_index', 'failure_reason', 'id', 'model_memory_limit', 'node.address', 'node.ephemeral_id', 'node.id', 'node.name', 'progress', 'source_index', 'state', 'type', 'version'] | str] | ~typing.Literal['assignment_explanation', 'create_time', 'description', 'dest_index', 'failure_reason', 'id', 'model_memory_limit', 'node.address', 'node.ephemeral_id', 'node.id', 'node.name', 'progress', 'source_index', 'state', 'type', 'version'] | str | None) – Comma-separated list of column names to display.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (Sequence[Literal['assignment_explanation', 'create_time', 'description', 'dest_index', 'failure_reason', 'id', 'model_memory_limit', 'node.address', 'node.ephemeral_id', 'node.id', 'node.name', 'progress', 'source_index', 'state', 'type', 'version'] | str] | ~typing.Literal['assignment_explanation', 'create_time', 'description', 'dest_index', 'failure_reason', 'id', 'model_memory_limit', 'node.address', 'node.ephemeral_id', 'node.id', 'node.name', 'progress', 'source_index', 'state', 'type', 'version'] | str | None) – Comma-separated list of column names or column aliases used to sort the response.

  • time (Literal[-1] | ~typing.Literal[0] | str | None) – Unit used to display time values.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

ml_datafeeds(*, datafeed_id=None, allow_no_match=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, time=None, v=None)

Gets configuration and usage information about datafeeds.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-datafeeds.html

Parameters:
  • datafeed_id (str | None) – A numerical character string that uniquely identifies the datafeed.

  • allow_no_match (bool | None) – Specifies what to do when the request: * Contains wildcard expressions and there are no datafeeds that match. * Contains the _all string or no identifiers and there are no matches. * Contains wildcard expressions and there are only partial matches. If true, the API returns an empty datafeeds array when there are no matches and the subset of results when there are partial matches. If false, the API returns a 404 status code when there are no matches or only partial matches.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (Sequence[Literal['ae', 'bc', 'id', 'na', 'ne', 'ni', 'nn', 's', 'sba', 'sc', 'seah', 'st'] | str] | ~typing.Literal['ae', 'bc', 'id', 'na', 'ne', 'ni', 'nn', 's', 'sba', 'sc', 'seah', 'st'] | str | None) – Comma-separated list of column names to display.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (Sequence[Literal['ae', 'bc', 'id', 'na', 'ne', 'ni', 'nn', 's', 'sba', 'sc', 'seah', 'st'] | str] | ~typing.Literal['ae', 'bc', 'id', 'na', 'ne', 'ni', 'nn', 's', 'sba', 'sc', 'seah', 'st'] | str | None) – Comma-separated list of column names or column aliases used to sort the response.

  • time (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – The unit used to display time values.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

ml_jobs(*, job_id=None, allow_no_match=None, bytes=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, time=None, v=None)

Gets configuration and usage information about anomaly detection jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-anomaly-detectors.html

Parameters:
  • job_id (str | None) – Identifier for the anomaly detection job.

  • allow_no_match (bool | None) – Specifies what to do when the request: * Contains wildcard expressions and there are no jobs that match. * Contains the _all string or no identifiers and there are no matches. * Contains wildcard expressions and there are only partial matches. If true, the API returns an empty jobs array when there are no matches and the subset of results when there are partial matches. If false, the API returns a 404 status code when there are no matches or only partial matches.

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (Sequence[Literal['assignment_explanation', 'buckets.count', 'buckets.time.exp_avg', 'buckets.time.exp_avg_hour', 'buckets.time.max', 'buckets.time.min', 'buckets.time.total', 'data.buckets', 'data.earliest_record', 'data.empty_buckets', 'data.input_bytes', 'data.input_fields', 'data.input_records', 'data.invalid_dates', 'data.last', 'data.last_empty_bucket', 'data.last_sparse_bucket', 'data.latest_record', 'data.missing_fields', 'data.out_of_order_timestamps', 'data.processed_fields', 'data.processed_records', 'data.sparse_buckets', 'forecasts.memory.avg', 'forecasts.memory.max', 'forecasts.memory.min', 'forecasts.memory.total', 'forecasts.records.avg', 'forecasts.records.max', 'forecasts.records.min', 'forecasts.records.total', 'forecasts.time.avg', 'forecasts.time.max', 'forecasts.time.min', 'forecasts.time.total', 'forecasts.total', 'id', 'model.bucket_allocation_failures', 'model.by_fields', 'model.bytes', 'model.bytes_exceeded', 'model.categorization_status', 'model.categorized_doc_count', 'model.dead_category_count', 'model.failed_category_count', 'model.frequent_category_count', 'model.log_time', 'model.memory_limit', 'model.memory_status', 'model.over_fields', 'model.partition_fields', 'model.rare_category_count', 'model.timestamp', 'model.total_category_count', 'node.address', 'node.ephemeral_id', 'node.id', 'node.name', 'opened_time', 'state'] | str] | ~typing.Literal['assignment_explanation', 'buckets.count', 'buckets.time.exp_avg', 'buckets.time.exp_avg_hour', 'buckets.time.max', 'buckets.time.min', 'buckets.time.total', 'data.buckets', 'data.earliest_record', 'data.empty_buckets', 'data.input_bytes', 'data.input_fields', 'data.input_records', 'data.invalid_dates', 'data.last', 'data.last_empty_bucket', 'data.last_sparse_bucket', 'data.latest_record', 'data.missing_fields', 'data.out_of_order_timestamps', 'data.processed_fields', 'data.processed_records', 'data.sparse_buckets', 'forecasts.memory.avg', 'forecasts.memory.max', 'forecasts.memory.min', 'forecasts.memory.total', 'forecasts.records.avg', 'forecasts.records.max', 'forecasts.records.min', 'forecasts.records.total', 'forecasts.time.avg', 'forecasts.time.max', 'forecasts.time.min', 'forecasts.time.total', 'forecasts.total', 'id', 'model.bucket_allocation_failures', 'model.by_fields', 'model.bytes', 'model.bytes_exceeded', 'model.categorization_status', 'model.categorized_doc_count', 'model.dead_category_count', 'model.failed_category_count', 'model.frequent_category_count', 'model.log_time', 'model.memory_limit', 'model.memory_status', 'model.over_fields', 'model.partition_fields', 'model.rare_category_count', 'model.timestamp', 'model.total_category_count', 'node.address', 'node.ephemeral_id', 'node.id', 'node.name', 'opened_time', 'state'] | str | None) – Comma-separated list of column names to display.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (Sequence[Literal['assignment_explanation', 'buckets.count', 'buckets.time.exp_avg', 'buckets.time.exp_avg_hour', 'buckets.time.max', 'buckets.time.min', 'buckets.time.total', 'data.buckets', 'data.earliest_record', 'data.empty_buckets', 'data.input_bytes', 'data.input_fields', 'data.input_records', 'data.invalid_dates', 'data.last', 'data.last_empty_bucket', 'data.last_sparse_bucket', 'data.latest_record', 'data.missing_fields', 'data.out_of_order_timestamps', 'data.processed_fields', 'data.processed_records', 'data.sparse_buckets', 'forecasts.memory.avg', 'forecasts.memory.max', 'forecasts.memory.min', 'forecasts.memory.total', 'forecasts.records.avg', 'forecasts.records.max', 'forecasts.records.min', 'forecasts.records.total', 'forecasts.time.avg', 'forecasts.time.max', 'forecasts.time.min', 'forecasts.time.total', 'forecasts.total', 'id', 'model.bucket_allocation_failures', 'model.by_fields', 'model.bytes', 'model.bytes_exceeded', 'model.categorization_status', 'model.categorized_doc_count', 'model.dead_category_count', 'model.failed_category_count', 'model.frequent_category_count', 'model.log_time', 'model.memory_limit', 'model.memory_status', 'model.over_fields', 'model.partition_fields', 'model.rare_category_count', 'model.timestamp', 'model.total_category_count', 'node.address', 'node.ephemeral_id', 'node.id', 'node.name', 'opened_time', 'state'] | str] | ~typing.Literal['assignment_explanation', 'buckets.count', 'buckets.time.exp_avg', 'buckets.time.exp_avg_hour', 'buckets.time.max', 'buckets.time.min', 'buckets.time.total', 'data.buckets', 'data.earliest_record', 'data.empty_buckets', 'data.input_bytes', 'data.input_fields', 'data.input_records', 'data.invalid_dates', 'data.last', 'data.last_empty_bucket', 'data.last_sparse_bucket', 'data.latest_record', 'data.missing_fields', 'data.out_of_order_timestamps', 'data.processed_fields', 'data.processed_records', 'data.sparse_buckets', 'forecasts.memory.avg', 'forecasts.memory.max', 'forecasts.memory.min', 'forecasts.memory.total', 'forecasts.records.avg', 'forecasts.records.max', 'forecasts.records.min', 'forecasts.records.total', 'forecasts.time.avg', 'forecasts.time.max', 'forecasts.time.min', 'forecasts.time.total', 'forecasts.total', 'id', 'model.bucket_allocation_failures', 'model.by_fields', 'model.bytes', 'model.bytes_exceeded', 'model.categorization_status', 'model.categorized_doc_count', 'model.dead_category_count', 'model.failed_category_count', 'model.frequent_category_count', 'model.log_time', 'model.memory_limit', 'model.memory_status', 'model.over_fields', 'model.partition_fields', 'model.rare_category_count', 'model.timestamp', 'model.total_category_count', 'node.address', 'node.ephemeral_id', 'node.id', 'node.name', 'opened_time', 'state'] | str | None) – Comma-separated list of column names or column aliases used to sort the response.

  • time (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – The unit used to display time values.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

ml_trained_models(*, model_id=None, allow_no_match=None, bytes=None, error_trace=None, filter_path=None, format=None, from_=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, size=None, v=None)

Gets configuration and usage information about inference trained models.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-trained-model.html

Parameters:
  • model_id (str | None) – A unique identifier for the trained model.

  • allow_no_match (bool | None) – Specifies what to do when the request: contains wildcard expressions and there are no models that match; contains the _all string or no identifiers and there are no matches; contains wildcard expressions and there are only partial matches. If true, the API returns an empty array when there are no matches and the subset of results when there are partial matches. If false, the API returns a 404 status code when there are no matches or only partial matches.

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • from – Skips the specified number of transforms.

  • h (Sequence[Literal['create_time', 'created_by', 'data_frame_analytics_id', 'description', 'heap_size', 'id', 'ingest.count', 'ingest.current', 'ingest.failed', 'ingest.pipelines', 'ingest.time', 'license', 'operations', 'version'] | str] | ~typing.Literal['create_time', 'created_by', 'data_frame_analytics_id', 'description', 'heap_size', 'id', 'ingest.count', 'ingest.current', 'ingest.failed', 'ingest.pipelines', 'ingest.time', 'license', 'operations', 'version'] | str | None) – A comma-separated list of column names to display.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (Sequence[Literal['create_time', 'created_by', 'data_frame_analytics_id', 'description', 'heap_size', 'id', 'ingest.count', 'ingest.current', 'ingest.failed', 'ingest.pipelines', 'ingest.time', 'license', 'operations', 'version'] | str] | ~typing.Literal['create_time', 'created_by', 'data_frame_analytics_id', 'description', 'heap_size', 'id', 'ingest.count', 'ingest.current', 'ingest.failed', 'ingest.pipelines', 'ingest.time', 'license', 'operations', 'version'] | str | None) – A comma-separated list of column names or aliases used to sort the response.

  • size (int | None) – The maximum number of transforms to display.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

nodeattrs(*, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns information about custom node attributes.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-nodeattrs.html

Parameters:
  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

nodes(*, bytes=None, error_trace=None, filter_path=None, format=None, full_id=None, h=None, help=None, human=None, include_unloaded_segments=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns basic statistics about performance of cluster nodes.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-nodes.html

Parameters:
  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • full_id (bool | str | None) – If true, return the full node ID. If false, return the shortened node ID.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • include_unloaded_segments (bool | None) – If true, the response includes information from segments that are not loaded into memory.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

pending_tasks(*, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns a concise representation of the cluster pending tasks.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-pending-tasks.html

Parameters:
  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

plugins(*, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns information about installed plugins across nodes node.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-plugins.html

Parameters:
  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

recovery(*, index=None, active_only=None, bytes=None, detailed=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns information about index shard recoveries, both on-going completed.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-recovery.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

  • active_only (bool | None) – If true, the response only includes ongoing shard recoveries.

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • detailed (bool | None) – If true, the response includes detailed information about shard recoveries.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

repositories(*, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns information about snapshot repositories registered in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-repositories.html

Parameters:
  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

segments(*, index=None, bytes=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Provides low-level information about the segments in the shards of an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-segments.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

shards(*, index=None, bytes=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Provides a detailed view of shard allocation on nodes.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-shards.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

  • bytes (Literal['b', 'gb', 'kb', 'mb', 'pb', 'tb'] | str | None) – The unit used to display byte values.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

snapshots(*, repository=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, ignore_unavailable=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns all snapshots in a specific repository.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-snapshots.html

Parameters:
  • repository (str | Sequence[str] | None) – A comma-separated list of snapshot repositories used to limit the request. Accepts wildcard expressions. _all returns all repositories. If any repository fails during the request, Elasticsearch returns an error.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • ignore_unavailable (bool | None) – If true, the response does not include information from unavailable snapshots.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

tasks(*, actions=None, detailed=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, node_id=None, parent_task_id=None, pretty=None, s=None, v=None)

Returns information about the tasks currently executing on one or more nodes in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/tasks.html

Parameters:
  • actions (Sequence[str] | None) – The task action names, which are used to limit the response.

  • detailed (bool | None) – If true, the response includes detailed information about shard recoveries.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • node_id (Sequence[str] | None) – Unique node identifiers, which are used to limit the response.

  • parent_task_id (str | None) – The parent task identifier, which is used to limit the response.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

templates(*, name=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, v=None)

Returns information about existing templates.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-templates.html

Parameters:
  • name (str | None) – The name of the template to return. Accepts wildcard expressions. If omitted, all templates are returned.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

thread_pool(*, thread_pool_patterns=None, error_trace=None, filter_path=None, format=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, time=None, v=None)

Returns cluster-wide thread pool statistics per node. By default the active, queue and rejected statistics are returned for all thread pools.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-thread-pool.html

Parameters:
  • thread_pool_patterns (str | Sequence[str] | None) – A comma-separated list of thread pool names used to limit the request. Accepts wildcard expressions.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • h (str | Sequence[str] | None) – List of columns to appear in the response. Supports simple wildcards.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (str | Sequence[str] | None) – List of columns that determine how the table should be sorted. Sorting defaults to ascending and can be changed by setting :asc or :desc as a suffix to the column name.

  • time (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – The unit used to display time values.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

transforms(*, transform_id=None, allow_no_match=None, error_trace=None, filter_path=None, format=None, from_=None, h=None, help=None, human=None, local=None, master_timeout=None, pretty=None, s=None, size=None, time=None, v=None)

Gets configuration and usage information about transforms.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cat-transforms.html

Parameters:
  • transform_id (str | None) – A transform identifier or a wildcard expression. If you do not specify one of these options, the API returns information for all transforms.

  • allow_no_match (bool | None) – Specifies what to do when the request: contains wildcard expressions and there are no transforms that match; contains the _all string or no identifiers and there are no matches; contains wildcard expressions and there are only partial matches. If true, it returns an empty transforms array when there are no matches and the subset of results when there are partial matches. If false, the request returns a 404 status code when there are no matches or only partial matches.

  • format (str | None) – Specifies the format to return the columnar data in, can be set to text, json, cbor, yaml, or smile.

  • from – Skips the specified number of transforms.

  • h (Sequence[Literal['changes_last_detection_time', 'checkpoint', 'checkpoint_duration_time_exp_avg', 'checkpoint_progress', 'create_time', 'delete_time', 'description', 'dest_index', 'docs_per_second', 'documents_deleted', 'documents_indexed', 'documents_processed', 'frequency', 'id', 'index_failure', 'index_time', 'index_total', 'indexed_documents_exp_avg', 'last_search_time', 'max_page_search_size', 'pages_processed', 'pipeline', 'processed_documents_exp_avg', 'processing_time', 'reason', 'search_failure', 'search_time', 'search_total', 'source_index', 'state', 'transform_type', 'trigger_count', 'version'] | str] | ~typing.Literal['changes_last_detection_time', 'checkpoint', 'checkpoint_duration_time_exp_avg', 'checkpoint_progress', 'create_time', 'delete_time', 'description', 'dest_index', 'docs_per_second', 'documents_deleted', 'documents_indexed', 'documents_processed', 'frequency', 'id', 'index_failure', 'index_time', 'index_total', 'indexed_documents_exp_avg', 'last_search_time', 'max_page_search_size', 'pages_processed', 'pipeline', 'processed_documents_exp_avg', 'processing_time', 'reason', 'search_failure', 'search_time', 'search_total', 'source_index', 'state', 'transform_type', 'trigger_count', 'version'] | str | None) – Comma-separated list of column names to display.

  • help (bool | None) – When set to true will output available columns. This option can’t be combined with any other query string option.

  • local (bool | None) – If true, the request computes the list of selected nodes from the local cluster state. If false the list of selected nodes are computed from the cluster state of the master node. In both cases the coordinating node will send requests for further information to each selected node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • s (Sequence[Literal['changes_last_detection_time', 'checkpoint', 'checkpoint_duration_time_exp_avg', 'checkpoint_progress', 'create_time', 'delete_time', 'description', 'dest_index', 'docs_per_second', 'documents_deleted', 'documents_indexed', 'documents_processed', 'frequency', 'id', 'index_failure', 'index_time', 'index_total', 'indexed_documents_exp_avg', 'last_search_time', 'max_page_search_size', 'pages_processed', 'pipeline', 'processed_documents_exp_avg', 'processing_time', 'reason', 'search_failure', 'search_time', 'search_total', 'source_index', 'state', 'transform_type', 'trigger_count', 'version'] | str] | ~typing.Literal['changes_last_detection_time', 'checkpoint', 'checkpoint_duration_time_exp_avg', 'checkpoint_progress', 'create_time', 'delete_time', 'description', 'dest_index', 'docs_per_second', 'documents_deleted', 'documents_indexed', 'documents_processed', 'frequency', 'id', 'index_failure', 'index_time', 'index_total', 'indexed_documents_exp_avg', 'last_search_time', 'max_page_search_size', 'pages_processed', 'pipeline', 'processed_documents_exp_avg', 'processing_time', 'reason', 'search_failure', 'search_time', 'search_total', 'source_index', 'state', 'transform_type', 'trigger_count', 'version'] | str | None) – Comma-separated list of column names or column aliases used to sort the response.

  • size (int | None) – The maximum number of transforms to obtain.

  • time (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – The unit used to display time values.

  • v (bool | None) – When set to true will enable verbose output.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any] | TextApiResponse

Cross-Cluster Replication (CCR)

class elasticsearch.client.CcrClient(client)
Parameters:

client (BaseClient) –

delete_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes auto-follow patterns.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-delete-auto-follow-pattern.html

Parameters:
  • name (str) – The name of the auto follow pattern.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

follow(*, index, error_trace=None, filter_path=None, human=None, leader_index=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None, remote_cluster=None, wait_for_active_shards=None)

Creates a new follower index configured to follow the referenced leader index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-put-follow.html

Parameters:
  • index (str) – The name of the follower index

  • leader_index (str | None) –

  • max_outstanding_read_requests (int | None) –

  • max_outstanding_write_requests (int | None) –

  • max_read_request_operation_count (int | None) –

  • max_read_request_size (str | None) –

  • max_retry_delay (Literal[-1] | ~typing.Literal[0] | str | None) –

  • max_write_buffer_count (int | None) –

  • max_write_buffer_size (str | None) –

  • max_write_request_operation_count (int | None) –

  • max_write_request_size (str | None) –

  • read_poll_timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • remote_cluster (str | None) –

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – Sets the number of shard copies that must be active before returning. Defaults to 0. Set to all for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

follow_info(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information about all follower indices, including parameters and status for each follower index

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-get-follow-info.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index patterns; use _all to perform the operation on all indices

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

follow_stats(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves follower stats. return shard-level stats about the following tasks associated with each shard for the specified indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-get-follow-stats.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index patterns; use _all to perform the operation on all indices

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

forget_follower(*, index, error_trace=None, filter_path=None, follower_cluster=None, follower_index=None, follower_index_uuid=None, human=None, leader_remote_cluster=None, pretty=None)

Removes the follower retention leases from the leader.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-post-forget-follower.html

Parameters:
  • index (str) – the name of the leader index for which specified follower retention leases should be removed

  • follower_cluster (str | None) –

  • follower_index (str | None) –

  • follower_index_uuid (str | None) –

  • leader_remote_cluster (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_auto_follow_pattern(*, name=None, error_trace=None, filter_path=None, human=None, pretty=None)

Gets configured auto-follow patterns. Returns the specified auto-follow pattern collection.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-get-auto-follow-pattern.html

Parameters:
  • name (str | None) – Specifies the auto-follow pattern collection that you want to retrieve. If you do not specify a name, the API returns information for all collections.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

pause_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Pauses an auto-follow pattern

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-pause-auto-follow-pattern.html

Parameters:
  • name (str) – The name of the auto follow pattern that should pause discovering new indices to follow.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

pause_follow(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Pauses a follower index. The follower index will not fetch any additional operations from the leader index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-post-pause-follow.html

Parameters:
  • index (str) – The name of the follower index that should pause following its leader index.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_auto_follow_pattern(*, name, remote_cluster, error_trace=None, filter_path=None, follow_index_pattern=None, human=None, leader_index_exclusion_patterns=None, leader_index_patterns=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None, settings=None)

Creates a new named collection of auto-follow patterns against a specified remote cluster. Newly created indices on the remote cluster matching any of the specified patterns will be automatically configured as follower indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-put-auto-follow-pattern.html

Parameters:
  • name (str) – The name of the collection of auto-follow patterns.

  • remote_cluster (str) – The remote cluster containing the leader indices to match against.

  • follow_index_pattern (str | None) – The name of follower index. The template {{leader_index}} can be used to derive the name of the follower index from the name of the leader index. When following a data stream, use {{leader_index}}; CCR does not support changes to the names of a follower data stream’s backing indices.

  • leader_index_exclusion_patterns (Sequence[str] | None) – An array of simple index patterns that can be used to exclude indices from being auto-followed. Indices in the remote cluster whose names are matching one or more leader_index_patterns and one or more leader_index_exclusion_patterns won’t be followed.

  • leader_index_patterns (Sequence[str] | None) – An array of simple index patterns to match against indices in the remote cluster specified by the remote_cluster field.

  • max_outstanding_read_requests (int | None) – The maximum number of outstanding reads requests from the remote cluster.

  • max_outstanding_write_requests (int | None) – The maximum number of outstanding reads requests from the remote cluster.

  • max_read_request_operation_count (int | None) – The maximum number of operations to pull per read from the remote cluster.

  • max_read_request_size (int | str | None) – The maximum size in bytes of per read of a batch of operations pulled from the remote cluster.

  • max_retry_delay (Literal[-1] | ~typing.Literal[0] | str | None) – The maximum time to wait before retrying an operation that failed exceptionally. An exponential backoff strategy is employed when retrying.

  • max_write_buffer_count (int | None) – The maximum number of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the number of queued operations goes below the limit.

  • max_write_buffer_size (int | str | None) – The maximum total bytes of operations that can be queued for writing. When this limit is reached, reads from the remote cluster will be deferred until the total bytes of queued operations goes below the limit.

  • max_write_request_operation_count (int | None) – The maximum number of operations per bulk write request executed on the follower.

  • max_write_request_size (int | str | None) – The maximum total bytes of operations per bulk write request executed on the follower.

  • read_poll_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – The maximum time to wait for new operations on the remote cluster when the follower index is synchronized with the leader index. When the timeout has elapsed, the poll for operations will return to the follower so that it can update some statistics. Then the follower will immediately attempt to read from the leader again.

  • settings (Mapping[str, Any] | None) – Settings to override from the leader index. Note that certain settings can not be overrode (e.g., index.number_of_shards).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

resume_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Resumes an auto-follow pattern that has been paused

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-resume-auto-follow-pattern.html

Parameters:
  • name (str) – The name of the auto follow pattern to resume discovering new indices to follow.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

resume_follow(*, index, error_trace=None, filter_path=None, human=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None)

Resumes a follower index that has been paused

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-post-resume-follow.html

Parameters:
  • index (str) – The name of the follow index to resume following.

  • max_outstanding_read_requests (int | None) –

  • max_outstanding_write_requests (int | None) –

  • max_read_request_operation_count (int | None) –

  • max_read_request_size (str | None) –

  • max_retry_delay (Literal[-1] | ~typing.Literal[0] | str | None) –

  • max_write_buffer_count (int | None) –

  • max_write_buffer_size (str | None) –

  • max_write_request_operation_count (int | None) –

  • max_write_request_size (str | None) –

  • read_poll_timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stats(*, error_trace=None, filter_path=None, human=None, pretty=None)

Gets all stats related to cross-cluster replication.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-get-stats.html

Parameters:
Return type:

ObjectApiResponse[Any]

unfollow(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Stops the following task associated with a follower index and removes index metadata and settings associated with cross-cluster replication.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ccr-post-unfollow.html

Parameters:
  • index (str) – The name of the follower index that should be turned into a regular index.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Cluster

class elasticsearch.client.ClusterClient(client)
Parameters:

client (BaseClient) –

allocation_explain(*, current_node=None, error_trace=None, filter_path=None, human=None, include_disk_info=None, include_yes_decisions=None, index=None, pretty=None, primary=None, shard=None)

Provides explanations for shard allocations in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-allocation-explain.html

Parameters:
  • current_node (str | None) – Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node.

  • include_disk_info (bool | None) – If true, returns information about disk usage and shard sizes.

  • include_yes_decisions (bool | None) – If true, returns YES decisions in explanation.

  • index (str | None) – Specifies the name of the index that you would like an explanation for.

  • primary (bool | None) – If true, returns explanation for the primary shard for the given shard ID.

  • shard (int | None) – Specifies the ID of the shard that you would like an explanation for.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_component_template(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes a component template

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-component-template.html

Parameters:
  • name (str | Sequence[str]) – Comma-separated list or wildcard expression of component template names used to limit the request.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_voting_config_exclusions(*, error_trace=None, filter_path=None, human=None, pretty=None, wait_for_removal=None)

Clears cluster voting config exclusions.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/voting-config-exclusions.html

Parameters:
  • wait_for_removal (bool | None) – Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. Defaults to true, meaning that all excluded nodes must be removed from the cluster before this API takes any action. If set to false then the voting configuration exclusions list is cleared even if some excluded nodes are still in the cluster.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

exists_component_template(*, name, error_trace=None, filter_path=None, human=None, local=None, master_timeout=None, pretty=None)

Returns information about whether a particular component template exist

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-component-template.html

Parameters:
  • name (str | Sequence[str]) – Comma-separated list of component template names used to limit the request. Wildcard (*) expressions are supported.

  • local (bool | None) – If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

HeadApiResponse

get_component_template(*, name=None, error_trace=None, filter_path=None, flat_settings=None, human=None, include_defaults=None, local=None, master_timeout=None, pretty=None)

Returns one or more component templates

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-component-template.html

Parameters:
  • name (str | None) – Comma-separated list of component template names used to limit the request. Wildcard (*) expressions are supported.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • include_defaults (bool | None) – Return all default configurations for the component template (default: false)

  • local (bool | None) – If true, the request retrieves information from the local node only. If false, information is retrieved from the master node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_settings(*, error_trace=None, filter_path=None, flat_settings=None, human=None, include_defaults=None, master_timeout=None, pretty=None, timeout=None)

Returns cluster settings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-get-settings.html

Parameters:
  • flat_settings (bool | None) – If true, returns settings in flat format.

  • include_defaults (bool | None) – If true, returns default cluster settings from the local node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

health(*, index=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, level=None, local=None, master_timeout=None, pretty=None, timeout=None, wait_for_active_shards=None, wait_for_events=None, wait_for_no_initializing_shards=None, wait_for_no_relocating_shards=None, wait_for_nodes=None, wait_for_status=None)

Returns basic information about the health of the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-health.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported. To target all data streams and indices in a cluster, omit this parameter or use _all or *.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • level (Literal['cluster', 'indices', 'shards'] | str | None) – Can be one of cluster, indices or shards. Controls the details level of the health information returned.

  • local (bool | None) – If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not wait.

  • wait_for_events (Literal['high', 'immediate', 'languid', 'low', 'normal', 'urgent'] | str | None) – Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are processed.

  • wait_for_no_initializing_shards (bool | None) – A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard initializations. Defaults to false, which means it will not wait for initializing shards.

  • wait_for_no_relocating_shards (bool | None) – A boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard relocations. Defaults to false, which means it will not wait for relocating shards.

  • wait_for_nodes (int | str | None) – The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and <N. Alternatively, it is possible to use ge(N), le(N), gt(N) and lt(N) notation.

  • wait_for_status (Literal['green', 'red', 'yellow'] | str | None) – One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided or better, i.e. green > yellow > red. By default, will not wait for any status.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

info(*, target, error_trace=None, filter_path=None, human=None, pretty=None)

Returns different information about the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-info.html

Parameters:
  • target (Sequence[Literal['_all', 'http', 'ingest', 'script', 'thread_pool'] | str] | ~typing.Literal['_all', 'http', 'ingest', 'script', 'thread_pool'] | str) – Limits the information returned to the specific target. Supports a comma-separated list, such as http,ingest.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

pending_tasks(*, error_trace=None, filter_path=None, human=None, local=None, master_timeout=None, pretty=None)

Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been executed.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-pending.html

Parameters:
  • local (bool | None) – If true, the request retrieves information from the local node only. If false, information is retrieved from the master node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

post_voting_config_exclusions(*, error_trace=None, filter_path=None, human=None, node_ids=None, node_names=None, pretty=None, timeout=None)

Updates the cluster voting config exclusions by node ids or node names.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/voting-config-exclusions.html

Parameters:
  • node_ids (str | Sequence[str] | None) – A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify node_names.

  • node_names (str | Sequence[str] | None) – A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify node_ids.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – When adding a voting configuration exclusion, the API waits for the specified nodes to be excluded from the voting configuration before returning. If the timeout expires before the appropriate condition is satisfied, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_component_template(*, name, template, allow_auto_create=None, create=None, error_trace=None, filter_path=None, human=None, master_timeout=None, meta=None, pretty=None, version=None)

Creates or updates a component template

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-component-template.html

Parameters:
  • name (str) – Name of the component template to create. Elasticsearch includes the following built-in component templates: logs-mappings; ‘logs-settings`; metrics-mappings; metrics-settings;`synthetics-mapping`; synthetics-settings. Elastic Agent uses these templates to configure backing indices for its data streams. If you use Elastic Agent and want to overwrite one of these templates, set the version for your replacement template higher than the current version. If you don’t use Elastic Agent and want to disable all built-in component and index templates, set stack.templates.enabled to false using the cluster update settings API.

  • template (Mapping[str, Any]) – The template to be applied which includes mappings, settings, or aliases configuration.

  • allow_auto_create (bool | None) – This setting overrides the value of the action.auto_create_index cluster setting. If set to true in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via actions.auto_create_index. If set to false then data streams matching the template must always be explicitly created.

  • create (bool | None) – If true, this request cannot replace or update existing component templates.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • meta (Mapping[str, Any] | None) – Optional user metadata about the component template. May have any contents. This map is not automatically generated by Elasticsearch. This information is stored in the cluster state, so keeping it short is preferable. To unset _meta, replace the template without specifying this information.

  • version (int | None) – Version number used to manage component templates externally. This number isn’t automatically generated or incremented by Elasticsearch. To unset a version, replace the template without specifying a version.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_settings(*, error_trace=None, filter_path=None, flat_settings=None, human=None, master_timeout=None, persistent=None, pretty=None, timeout=None, transient=None)

Updates the cluster settings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-update-settings.html

Parameters:
  • flat_settings (bool | None) – Return settings in flat format (default: false)

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • persistent (Mapping[str, Any] | None) –

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • transient (Mapping[str, Any] | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

remote_info(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the information about configured remote clusters.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-remote-info.html

Parameters:
Return type:

ObjectApiResponse[Any]

reroute(*, commands=None, dry_run=None, error_trace=None, explain=None, filter_path=None, human=None, master_timeout=None, metric=None, pretty=None, retry_failed=None, timeout=None)

Allows to manually change the allocation of individual shards in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-reroute.html

Parameters:
  • commands (Sequence[Mapping[str, Any]] | None) – Defines the commands to perform.

  • dry_run (bool | None) – If true, then the request simulates the operation only and returns the resulting state.

  • explain (bool | None) – If true, then the response contains an explanation of why the commands can or cannot be executed.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • metric (str | Sequence[str] | None) – Limits the information returned to the specified metrics.

  • retry_failed (bool | None) – If true, then retries allocation of shards that are blocked due to too many subsequent allocation failures.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

state(*, metric=None, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, flat_settings=None, human=None, ignore_unavailable=None, local=None, master_timeout=None, pretty=None, wait_for_metadata_version=None, wait_for_timeout=None)

Returns a comprehensive information about the state of the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-state.html

Parameters:
  • metric (str | Sequence[str] | None) – Limit the information returned to the specified metrics

  • index (str | Sequence[str] | None) – A comma-separated list of index names; use _all or empty string to perform the operation on all indices

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • flat_settings (bool | None) – Return settings in flat format (default: false)

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • local (bool | None) – Return local information, do not retrieve the state from master node (default: false)

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • wait_for_metadata_version (int | None) – Wait for the metadata version to be equal or greater than the specified metadata version

  • wait_for_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – The maximum time to wait for wait_for_metadata_version before timing out

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

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

Returns high-level overview of cluster statistics.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-stats.html

Parameters:
  • node_id (str | Sequence[str] | None) – Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, timed out nodes are included in the response’s _nodes.failed property. Defaults to no timeout.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Dangling Indices

class elasticsearch.client.DanglingIndicesClient(client)
Parameters:

client (BaseClient) –

delete_dangling_index(*, index_uuid, accept_data_loss, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes the specified dangling index

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-gateway-dangling-indices.html

Parameters:
  • index_uuid (str) – The UUID of the dangling index

  • accept_data_loss (bool) – Must be set to true in order to delete the dangling index

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

import_dangling_index(*, index_uuid, accept_data_loss, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Imports the specified dangling index

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-gateway-dangling-indices.html

Parameters:
  • index_uuid (str) – The UUID of the dangling index

  • accept_data_loss (bool) – Must be set to true in order to import the dangling index

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

list_dangling_indices(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns all dangling indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-gateway-dangling-indices.html

Parameters:
Return type:

ObjectApiResponse[Any]

Enrich Policies

class elasticsearch.client.EnrichClient(client)
Parameters:

client (BaseClient) –

delete_policy(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes an existing enrich policy and its enrich index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-enrich-policy-api.html

Parameters:
  • name (str) – Enrich policy to delete.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

execute_policy(*, name, error_trace=None, filter_path=None, human=None, pretty=None, wait_for_completion=None)

Creates the enrich index for an existing enrich policy.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/execute-enrich-policy-api.html

Parameters:
  • name (str) – Enrich policy to execute.

  • wait_for_completion (bool | None) – If true, the request blocks other enrich policy execution requests until complete.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_policy(*, name=None, error_trace=None, filter_path=None, human=None, pretty=None)

Gets information about an enrich policy.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-enrich-policy-api.html

Parameters:
  • name (str | Sequence[str] | None) – Comma-separated list of enrich policy names used to limit the request. To return information for all enrich policies, omit this parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_policy(*, name, error_trace=None, filter_path=None, geo_match=None, human=None, match=None, pretty=None, range=None)

Creates a new enrich policy.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-enrich-policy-api.html

Parameters:
  • name (str) – Name of the enrich policy to create or update.

  • geo_match (Mapping[str, Any] | None) – Matches enrich data to incoming documents based on a geo_shape query.

  • match (Mapping[str, Any] | None) – Matches enrich data to incoming documents based on a term query.

  • range (Mapping[str, Any] | None) – Matches a number, date, or IP address in incoming documents to a range in the enrich index based on a term query.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stats(*, error_trace=None, filter_path=None, human=None, pretty=None)

Gets enrich coordinator statistics and information about enrich policies that are currently executing.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/enrich-stats-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

Event Query Language (EQL)

class elasticsearch.client.EqlClient(client)
Parameters:

client (BaseClient) –

delete(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes an async EQL search by ID. If the search is still running, the search request will be cancelled. Otherwise, the saved search results are deleted.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/eql-search-api.html

Parameters:
  • id (str) – Identifier for the search to delete. A search ID is provided in the EQL search API’s response for an async search. A search ID is also provided if the request’s keep_on_completion parameter is true.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get(*, id, error_trace=None, filter_path=None, human=None, keep_alive=None, pretty=None, wait_for_completion_timeout=None)

Returns async results from previously executed Event Query Language (EQL) search

`< https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-async-eql-search-api.html>`_

Parameters:
  • id (str) – Identifier for the search.

  • keep_alive (Literal[-1] | ~typing.Literal[0] | str | None) – Period for which the search and its results are stored on the cluster. Defaults to the keep_alive value set by the search’s EQL search API request.

  • wait_for_completion_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Timeout duration to wait for the request to finish. Defaults to no timeout, meaning the request waits for complete search results.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_status(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the status of a previously submitted async or stored Event Query Language (EQL) search

`< https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-async-eql-status-api.html>`_

Parameters:
  • id (str) – Identifier for the search.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

search(*, index, query, allow_no_indices=None, case_sensitive=None, error_trace=None, event_category_field=None, expand_wildcards=None, fetch_size=None, fields=None, filter=None, filter_path=None, human=None, ignore_unavailable=None, keep_alive=None, keep_on_completion=None, pretty=None, result_position=None, runtime_mappings=None, size=None, tiebreaker_field=None, timestamp_field=None, wait_for_completion_timeout=None)

Returns results matching a query expressed in Event Query Language (EQL)

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/eql-search-api.html

Parameters:
  • index (str | Sequence[str]) – The name of the index to scope the operation

  • query (str) – EQL query you wish to run.

  • allow_no_indices (bool | None) –

  • case_sensitive (bool | None) –

  • event_category_field (str | None) – Field containing the event classification, such as process, file, or network.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) –

  • fetch_size (int | None) – Maximum number of events to search at a time for sequence queries.

  • fields (Mapping[str, Any] | Sequence[Mapping[str, Any]] | None) – Array of wildcard (*) patterns. The response returns values for field names matching these patterns in the fields property of each hit.

  • filter (Mapping[str, Any] | Sequence[Mapping[str, Any]] | None) – Query, written in Query DSL, used to filter the events on which the EQL query runs.

  • ignore_unavailable (bool | None) – If true, missing or closed indices are not included in the response.

  • keep_alive (Literal[-1] | ~typing.Literal[0] | str | None) –

  • keep_on_completion (bool | None) –

  • result_position (Literal['head', 'tail'] | str | None) –

  • runtime_mappings (Mapping[str, Mapping[str, Any]] | None) –

  • size (int | None) – For basic queries, the maximum number of matching events to return. Defaults to 10

  • tiebreaker_field (str | None) – Field used to sort hits with the same timestamp in ascending order

  • timestamp_field (str | None) – Field containing event timestamp. Default “@timestamp”

  • wait_for_completion_timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Snapshottable Features

class elasticsearch.client.FeaturesClient(client)
Parameters:

client (BaseClient) –

get_features(*, error_trace=None, filter_path=None, human=None, pretty=None)

Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-features-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

reset_features(*, error_trace=None, filter_path=None, human=None, pretty=None)

Resets the internal state of features, usually by deleting system indices

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
Return type:

ObjectApiResponse[Any]

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.10/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 (Literal[-1] | ~typing.Literal[0] | str | 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, 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)

Multi Search API where the search will only be executed after specified checkpoints are available due to a refresh. This API is designed for internal use by the fleet server project.

Parameters:
  • searches (Sequence[Mapping[str, Any]]) –

  • 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[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | 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 (Literal['dfs_query_then_fetch', 'query_then_fetch'] | str | 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) –

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

Search API where the search will only be executed after specified checkpoints are available due to a refresh. This API is designed for internal use by the fleet server project.

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

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

  • collapse (Mapping[str, Any] | None) –

  • default_operator (Literal['and', 'or'] | str | 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[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | 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) –

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

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

  • search_after (Sequence[None | bool | float | int | str | Any] | None) –

  • search_type (Literal['dfs_query_then_fetch', 'query_then_fetch'] | str | 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 (Literal['always', 'missing', 'popular'] | str | 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) –

Return type:

ObjectApiResponse[Any]

Graph Explore

class elasticsearch.client.GraphClient(client)
Parameters:

client (BaseClient) –

explore(*, index, connections=None, controls=None, error_trace=None, filter_path=None, human=None, pretty=None, query=None, routing=None, timeout=None, vertices=None)

Explore extracted and summarized information about the documents and terms in an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/graph-explore-api.html

Parameters:
  • index (str | Sequence[str]) – Name of the index.

  • connections (Mapping[str, Any] | None) – Specifies or more fields from which you want to extract terms that are associated with the specified vertices.

  • controls (Mapping[str, Any] | None) – Direct the Graph API how to build the graph.

  • query (Mapping[str, Any] | None) – A seed query that identifies the documents of interest. Can be any valid Elasticsearch query.

  • routing (str | None) – Custom value used to route operations to a specific shard.

  • timeout (Literal[-1] | ~typing.Literal[0] | 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.

  • vertices (Sequence[Mapping[str, Any]] | None) – Specifies one or more fields that contain the terms you want to include in the graph as vertices.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Index Lifecycle Management (ILM)

class elasticsearch.client.IlmClient(client)
Parameters:

client (BaseClient) –

delete_lifecycle(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes the specified lifecycle policy definition. A currently used policy cannot be deleted.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-delete-lifecycle.html

Parameters:
  • name (str) – Identifier for the policy.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

explain_lifecycle(*, index, error_trace=None, filter_path=None, human=None, master_timeout=None, only_errors=None, only_managed=None, pretty=None, timeout=None)

Retrieves information about the index’s current lifecycle state, such as the currently executing phase, action, and step.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-explain-lifecycle.html

Parameters:
  • index (str) – Comma-separated list of data streams, indices, and aliases to target. Supports wildcards (*). To target all data streams and indices, use * or _all.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • only_errors (bool | None) – Filters the returned indices to only indices that are managed by ILM and are in an error state, either due to an encountering an error while executing the policy, or attempting to use a policy that does not exist.

  • only_managed (bool | None) – Filters the returned indices to only indices that are managed by ILM.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_lifecycle(*, name=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Returns the specified policy definition. Includes the policy version and last modified date.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-get-lifecycle.html

Parameters:
  • name (str | None) – Identifier for the policy.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_status(*, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves the current index lifecycle management (ILM) status.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-get-status.html

Parameters:
Return type:

ObjectApiResponse[Any]

migrate_to_data_tiers(*, dry_run=None, error_trace=None, filter_path=None, human=None, legacy_template_to_delete=None, node_attribute=None, pretty=None)

Migrates the indices and ILM policies away from custom node attribute allocation routing to data tiers routing

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-migrate-to-data-tiers.html

Parameters:
  • dry_run (bool | None) – If true, simulates the migration from node attributes based allocation filters to data tiers, but does not perform the migration. This provides a way to retrieve the indices and ILM policies that need to be migrated.

  • legacy_template_to_delete (str | None) –

  • node_attribute (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

move_to_step(*, index, current_step=None, error_trace=None, filter_path=None, human=None, next_step=None, pretty=None)

Manually moves an index into the specified step and executes that step.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-move-to-step.html

Parameters:
  • index (str) – The name of the index whose lifecycle step is to change

  • current_step (Mapping[str, Any] | None) –

  • next_step (Mapping[str, Any] | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_lifecycle(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, policy=None, pretty=None, timeout=None)

Creates a lifecycle policy

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-put-lifecycle.html

Parameters:
  • name (str) – Identifier for the policy.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • policy (Mapping[str, Any] | None) –

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

remove_policy(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Removes the assigned lifecycle policy and stops managing the specified index

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-remove-policy.html

Parameters:
  • index (str) – The name of the index to remove policy on

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

retry(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Retries executing the policy for an index that is in the ERROR step.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-retry-policy.html

Parameters:
  • index (str) – The name of the indices (comma-separated) whose failed lifecycle step is to be retry

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

start(*, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Start the index lifecycle management (ILM) plugin.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-start.html

Parameters:
  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stop(*, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Halts all lifecycle management operations and stops the index lifecycle management (ILM) plugin

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ilm-stop.html

Parameters:
  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Indices

class elasticsearch.client.IndicesClient(client)
Parameters:

client (BaseClient) –

add_block(*, index, block, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, pretty=None, timeout=None)

Adds a block to an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/index-modules-blocks.html

Parameters:
  • index (str) – A comma separated list of indices to add a block to

  • block (Literal['metadata', 'read', 'read_only', 'write'] | str) – The block to add (one of read, write, read_only or metadata)

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

analyze(*, index=None, analyzer=None, attributes=None, char_filter=None, error_trace=None, explain=None, field=None, filter=None, filter_path=None, human=None, normalizer=None, pretty=None, text=None, tokenizer=None)

Performs the analysis process on a text and return the tokens breakdown of the text.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-analyze.html

Parameters:
  • index (str | None) – Index used to derive the analyzer. If specified, the analyzer or field parameter overrides this value. If no index is specified or the index does not have a default analyzer, the analyze API uses the standard analyzer.

  • analyzer (str | None) – The name of the analyzer that should be applied to the provided text. This could be a built-in analyzer, or an analyzer that’s been configured in the index.

  • attributes (Sequence[str] | None) – Array of token attributes used to filter the output of the explain parameter.

  • char_filter (Sequence[str | Mapping[str, Any]] | None) – Array of character filters used to preprocess characters before the tokenizer.

  • explain (bool | None) – If true, the response includes token attributes and additional details.

  • field (str | None) – Field used to derive the analyzer. To use this parameter, you must specify an index. If specified, the analyzer parameter overrides this value.

  • filter (Sequence[str | Mapping[str, Any]] | None) – Array of token filters used to apply after the tokenizer.

  • normalizer (str | None) – Normalizer to use to convert text into a single token.

  • text (str | Sequence[str] | None) – Text to analyze. If an array of strings is provided, it is analyzed as a multi-value field.

  • tokenizer (str | Mapping[str, Any] | None) – Tokenizer to use to convert text into tokens.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clear_cache(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, fielddata=None, fields=None, filter_path=None, human=None, ignore_unavailable=None, pretty=None, query=None, request=None)

Clears all or specific caches for one or more indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-clearcache.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • fielddata (bool | None) – If true, clears the fields cache. Use the fields parameter to clear the cache of specific fields only.

  • fields (str | Sequence[str] | None) – Comma-separated list of field names used to limit the fielddata parameter.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • query (bool | None) – If true, clears the query cache.

  • request (bool | None) – If true, clears the request cache.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clone(*, index, target, aliases=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, settings=None, timeout=None, wait_for_active_shards=None)

Clones an index

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-clone-index.html

Parameters:
  • index (str) – Name of the source index to clone.

  • target (str) – Name of the target index to create.

  • aliases (Mapping[str, Mapping[str, Any]] | None) – Aliases for the resulting index.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • settings (Mapping[str, Any] | None) – Configuration options for the target index.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

close(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, pretty=None, timeout=None, wait_for_active_shards=None)

Closes an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-close.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list or wildcard expression of index names used to limit the request.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

create(*, index, aliases=None, error_trace=None, filter_path=None, human=None, mappings=None, master_timeout=None, pretty=None, settings=None, timeout=None, wait_for_active_shards=None)

Creates an index with optional settings and mappings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-create-index.html

Parameters:
  • index (str) – Name of the index you wish to create.

  • aliases (Mapping[str, Mapping[str, Any]] | None) – Aliases for the index.

  • mappings (Mapping[str, Any] | None) – Mapping for fields in the index. If specified, this mapping can include: - Field names - Field data types - Mapping parameters

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • settings (Mapping[str, Any] | None) – Configuration options for the index.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

create_data_stream(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Creates a data stream

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/data-streams.html

Parameters:
  • name (str) – Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include `, `/, *, ?, , <, >, |, ,, #, :, or a space character; Cannot start with -, _, +, or .ds-; Cannot be . or ..; Cannot be longer than 255 bytes. Multi-byte characters count towards this limit faster.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

data_streams_stats(*, name=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, pretty=None)

Provides statistics on operations happening in a data stream.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/data-streams.html

Parameters:
  • name (str | None) – Comma-separated list of data streams used to limit the request. Wildcard expressions (*) are supported. To target all data streams in a cluster, omit this parameter or use *.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, pretty=None, timeout=None)

Deletes an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-delete-index.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not support wildcards (*) or _all. To use wildcards or _all, set the action.destructive_requires_name cluster setting to false.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_alias(*, index, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes an alias.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-aliases.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list of data streams or indices used to limit the request. Supports wildcards (*).

  • name (str | Sequence[str]) – Comma-separated list of aliases to remove. Supports wildcards (*). To remove all aliases, use * or _all.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_data_lifecycle(*, name, error_trace=None, expand_wildcards=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes the data lifecycle of the selected data streams.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/dlm-delete-lifecycle.html

Parameters:
  • name (str | Sequence[str]) – A comma-separated list of data streams of which the data lifecycle will be deleted; use * to get all data streams

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether wildcard expressions should get expanded to open or closed indices (default: open)

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit timestamp for the document

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_data_stream(*, name, error_trace=None, expand_wildcards=None, filter_path=None, human=None, pretty=None)

Deletes a data stream.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/data-streams.html

Parameters:
  • name (str | Sequence[str]) – Comma-separated list of data streams to delete. Wildcard (*) expressions are supported.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of data stream that wildcard patterns can match. Supports comma-separated values,such as open,hidden.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_index_template(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes an index template.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str | Sequence[str]) – Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_template(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes an index template.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str) – The name of the legacy index template to delete. Wildcard (*) expressions are supported.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

disk_usage(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, flush=None, human=None, ignore_unavailable=None, pretty=None, run_expensive_tasks=None)

Analyzes the disk usage of each field of an index or data stream

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-disk-usage.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list of data streams, indices, and aliases used to limit the request. It’s recommended to execute this API with a single index (or the latest backing index of a data stream) as the API consumes resources significantly.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden.

  • flush (bool | None) – If true, the API performs a flush before analysis. If false, the response may not include uncommitted data.

  • ignore_unavailable (bool | None) – If true, missing or closed indices are not included in the response.

  • run_expensive_tasks (bool | None) – Analyzing field disk usage is resource-intensive. To use the API, this parameter must be set to true.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

downsample(*, index, target_index, config, error_trace=None, filter_path=None, human=None, pretty=None)

Downsample an index

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-downsample-data-stream.html

Parameters:
  • index (str) – Name of the time series index to downsample.

  • target_index (str) – Name of the index to create.

  • config (Mapping[str, Any]) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

exists(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, flat_settings=None, human=None, ignore_unavailable=None, include_defaults=None, local=None, pretty=None)

Returns information about whether a particular index exists.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-exists.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list of data streams, indices, and aliases. Supports wildcards (*).

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • include_defaults (bool | None) – If true, return all default settings in the response.

  • local (bool | None) – If true, the request retrieves information from the local node only.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

HeadApiResponse

exists_alias(*, name, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, local=None, pretty=None)

Returns information about whether a particular alias exists.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-aliases.html

Parameters:
  • name (str | Sequence[str]) – Comma-separated list of aliases to check. Supports wildcards (*).

  • index (str | Sequence[str] | None) – Comma-separated list of data streams or indices used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, requests that include a missing data stream or index in the target indices or data streams return an error.

  • local (bool | None) – If true, the request retrieves information from the local node only.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

HeadApiResponse

exists_index_template(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)

Returns information about whether a particular index template exists.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str) – Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

HeadApiResponse

exists_template(*, name, error_trace=None, filter_path=None, flat_settings=None, human=None, local=None, master_timeout=None, pretty=None)

Returns information about whether a particular index template exists.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str | Sequence[str]) – The comma separated names of the index templates

  • flat_settings (bool | None) – Return settings in flat format (default: false)

  • local (bool | None) – Return local information, do not retrieve the state from master node (default: false)

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

HeadApiResponse

explain_data_lifecycle(*, index, error_trace=None, filter_path=None, human=None, include_defaults=None, master_timeout=None, pretty=None)

Retrieves information about the index’s current DLM lifecycle, such as any potential encountered error, time since creation etc.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/dlm-explain-lifecycle.html

Parameters:
  • index (str | Sequence[str]) – The name of the index to explain

  • include_defaults (bool | None) – indicates if the API should return the default values the system uses for the index’s lifecycle

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specify timeout for connection to master

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

field_usage_stats(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, fields=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, pretty=None, timeout=None, wait_for_active_shards=None)

Returns the field usage stats for each field of an index

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/field-usage-stats.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list or wildcard expression of index names used to limit the request.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden.

  • fields (str | Sequence[str] | None) – Comma-separated list or wildcard expressions of fields to include in the statistics.

  • ignore_unavailable (bool | None) – If true, missing or closed indices are not included in the response.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

flush(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, force=None, human=None, ignore_unavailable=None, pretty=None, wait_if_ongoing=None)

Performs the flush operation on one or more indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-flush.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases to flush. Supports wildcards (*). To flush all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • force (bool | None) – If true, the request forces a flush even if there are no changes to commit to the index.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • wait_if_ongoing (bool | None) – If true, the flush operation blocks until execution when another flush operation is running. If false, Elasticsearch returns an error if you request a flush when another flush operation is running.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

forcemerge(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, flush=None, human=None, ignore_unavailable=None, max_num_segments=None, only_expunge_deletes=None, pretty=None, wait_for_completion=None)

Performs the force merge operation on one or more indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-forcemerge.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of index names; use _all or empty string to perform the operation on all indices

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • flush (bool | None) – Specify whether the index should be flushed after performing the operation (default: true)

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • max_num_segments (int | None) – The number of segments the index should be merged into (default: dynamic)

  • only_expunge_deletes (bool | None) – Specify whether the operation should only expunge deleted documents

  • wait_for_completion (bool | None) – Should the request wait until the force merge is completed.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, features=None, filter_path=None, flat_settings=None, human=None, ignore_unavailable=None, include_defaults=None, local=None, master_timeout=None, pretty=None)

Returns information about one or more indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-get-index.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | 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. Supports comma-separated values, such as open,hidden.

  • features (Sequence[Literal['aliases', 'mappings', 'settings'] | str] | ~typing.Literal['aliases', 'mappings', 'settings'] | str | None) – Return only information on specified index features

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • ignore_unavailable (bool | None) – If false, requests that target a missing index return an error.

  • include_defaults (bool | None) – If true, return all default settings in the response.

  • local (bool | None) – If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_alias(*, index=None, name=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, local=None, pretty=None)

Returns an alias.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-aliases.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams or indices used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

  • name (str | Sequence[str] | None) – Comma-separated list of aliases to retrieve. Supports wildcards (*). To retrieve all aliases, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • local (bool | None) – If true, the request retrieves information from the local node only.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_data_lifecycle(*, name, error_trace=None, expand_wildcards=None, filter_path=None, human=None, include_defaults=None, pretty=None)

Returns the data lifecycle of the selected data streams.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/dlm-get-lifecycle.html

Parameters:
  • name (str | Sequence[str]) – Comma-separated list of data streams to limit the request. Supports wildcards (*). To target all data streams, omit this parameter or use * or _all.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • include_defaults (bool | None) – If true, return all default settings in the response.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_data_stream(*, name=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, include_defaults=None, pretty=None)

Returns data streams.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/data-streams.html

Parameters:
  • name (str | Sequence[str] | None) – Comma-separated list of data stream names used to limit the request. Wildcard (*) expressions are supported. If omitted, all data streams are returned.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden.

  • include_defaults (bool | None) – If true, returns all relevant default configurations for the index template.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_field_mapping(*, fields, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, include_defaults=None, local=None, pretty=None)

Returns mapping for one or more fields.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-get-field-mapping.html

Parameters:
  • fields (str | Sequence[str]) – Comma-separated list or wildcard expression of fields used to limit returned information.

  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • include_defaults (bool | None) – If true, return all default settings in the response.

  • local (bool | None) – If true, the request retrieves information from the local node only.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_index_template(*, name=None, error_trace=None, filter_path=None, flat_settings=None, human=None, include_defaults=None, local=None, master_timeout=None, pretty=None)

Returns an index template.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str | None) – Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • include_defaults (bool | None) – If true, returns all relevant default configurations for the index template.

  • local (bool | None) – If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_mapping(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, local=None, master_timeout=None, pretty=None)

Returns mappings for one or more indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-get-mapping.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • local (bool | None) – If true, the request retrieves information from the local node only.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_settings(*, index=None, name=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, flat_settings=None, human=None, ignore_unavailable=None, include_defaults=None, local=None, master_timeout=None, pretty=None)

Returns settings for one or more indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-get-settings.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

  • name (str | Sequence[str] | None) – Comma-separated list or wildcard expression of settings to retrieve.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • include_defaults (bool | None) – If true, return all default settings in the response.

  • local (bool | None) – If true, the request retrieves information from the local node only. If false, information is retrieved from the master node.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_template(*, name=None, error_trace=None, filter_path=None, flat_settings=None, human=None, local=None, master_timeout=None, pretty=None)

Returns an index template.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str | Sequence[str] | None) – Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. To return all index templates, omit this parameter or use a value of _all or *.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • local (bool | None) – If true, the request retrieves information from the local node only.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

migrate_to_data_stream(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Migrates an alias to a data stream

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/data-streams.html

Parameters:
  • name (str) – Name of the index alias to convert to a data stream.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

modify_data_stream(*, actions, error_trace=None, filter_path=None, human=None, pretty=None)

Modifies a data stream

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/data-streams.html

Parameters:
Return type:

ObjectApiResponse[Any]

open(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, pretty=None, timeout=None, wait_for_active_shards=None)

Opens an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-open-close.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). By default, you must explicitly name the indices you using to limit the request. To limit a request using _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. You can update this setting in the elasticsearch.yml file or using the cluster update settings API.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

promote_data_stream(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Promotes a data stream from a replicated data stream managed by CCR to a regular data stream

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/data-streams.html

Parameters:
  • name (str) – The name of the data stream

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_alias(*, index, name, error_trace=None, filter=None, filter_path=None, human=None, index_routing=None, is_write_index=None, master_timeout=None, pretty=None, routing=None, search_routing=None, timeout=None)

Creates or updates an alias.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-aliases.html

Parameters:
  • index (str | Sequence[str]) – Comma-separated list of data streams or indices to add. Supports wildcards (*). Wildcard patterns that match both data streams and indices return an error.

  • name (str) – Alias to update. If the alias doesn’t exist, the request creates it. Index alias names support date math.

  • filter (Mapping[str, Any] | None) – Query used to limit documents the alias can access.

  • index_routing (str | None) – Value used to route indexing operations to a specific shard. If specified, this overwrites the routing value for indexing operations. Data stream aliases don’t support this parameter.

  • is_write_index (bool | None) – If true, sets the write index or data stream for the alias. If an alias points to multiple indices or data streams and is_write_index isn’t set, the alias rejects write requests. If an index alias points to one index and is_write_index isn’t set, the index automatically acts as the write index. Data stream aliases don’t automatically set a write data stream, even if the alias points to one data stream.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • routing (str | None) – Value used to route indexing and search operations to a specific shard. Data stream aliases don’t support this parameter.

  • search_routing (str | None) – Value used to route search operations to a specific shard. If specified, this overwrites the routing value for search operations. Data stream aliases don’t support this parameter.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_data_lifecycle(*, name, data_retention=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Updates the data lifecycle of the selected data streams.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/dlm-put-lifecycle.html

Parameters:
  • name (str | Sequence[str]) – Comma-separated list of data streams used to limit the request. Supports wildcards (*). To target all data streams use * or _all.

  • data_retention (Literal[-1] | ~typing.Literal[0] | str | None) – If defined, every document added to this data stream will be stored at least for this time frame. Any time after this duration the document could be deleted. When empty, every document in this data stream will be stored indefinitely.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of data stream that wildcard patterns can match. Supports comma-separated values, such as open,hidden. Valid values are: all, hidden, open, closed, none.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_index_template(*, name, composed_of=None, create=None, data_stream=None, error_trace=None, filter_path=None, human=None, index_patterns=None, meta=None, pretty=None, priority=None, template=None, version=None)

Creates or updates an index template.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str) – Index or template name

  • composed_of (Sequence[str] | None) – An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence.

  • create (bool | None) – If true, this request cannot replace or update existing index templates.

  • data_stream (Mapping[str, Any] | None) – If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. Data streams require a matching index template with a data_stream object.

  • index_patterns (str | Sequence[str] | None) – Name of the index template to create.

  • meta (Mapping[str, Any] | None) – Optional user metadata about the index template. May have any contents. This map is not automatically generated by Elasticsearch.

  • priority (int | None) – Priority to determine index template precedence when a new data stream or index is created. The index template with the highest priority is chosen. If no priority is specified the template is treated as though it is of priority 0 (lowest priority). This number is not automatically generated by Elasticsearch.

  • template (Mapping[str, Any] | None) – Template to be applied. It may optionally include an aliases, mappings, or settings configuration.

  • version (int | None) – Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_mapping(*, index, allow_no_indices=None, date_detection=None, dynamic=None, dynamic_date_formats=None, dynamic_templates=None, error_trace=None, expand_wildcards=None, field_names=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, meta=None, numeric_detection=None, pretty=None, properties=None, routing=None, runtime=None, source=None, timeout=None, write_index_only=None)

Updates the index mappings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-put-mapping.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or omit to add the mapping on all indices.

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

  • date_detection (bool | None) – Controls whether dynamic date detection is enabled.

  • dynamic (Literal['false', 'runtime', 'strict', 'true'] | str | None) – Controls whether new fields are added dynamically.

  • dynamic_date_formats (Sequence[str] | None) – If date detection is enabled then new string fields are checked against ‘dynamic_date_formats’ and if the value matches then a new date field is added instead of string.

  • dynamic_templates (Mapping[str, Mapping[str, Any]] | Sequence[Mapping[str, Mapping[str, Any]]] | None) – Specify dynamic templates for the mapping.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • field_names (Mapping[str, Any] | None) – Control whether field names are enabled for the index.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • meta (Mapping[str, Any] | None) – A mapping type can have custom meta data associated with it. These are not used at all by Elasticsearch, but can be used to store application-specific metadata.

  • numeric_detection (bool | None) – Automatically map strings into numeric data types for all fields.

  • properties (Mapping[str, Mapping[str, Any]] | None) – Mapping for a field. For new fields, this mapping can include: - Field name - Field data type - Mapping parameters

  • routing (Mapping[str, Any] | None) – Enable making a routing value required on indexed documents.

  • runtime (Mapping[str, Mapping[str, Any]] | None) – Mapping of runtime fields for the index.

  • source (Mapping[str, Any] | None) – Control whether the _source field is enabled on the index.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • write_index_only (bool | None) – If true, the mappings are applied only to the current write index for the target.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_settings(*, settings, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, flat_settings=None, human=None, ignore_unavailable=None, master_timeout=None, preserve_existing=None, pretty=None, timeout=None)

Updates the index settings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-update-settings.html

Parameters:
  • settings (Mapping[str, Any]) –

  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • ignore_unavailable (bool | None) – If true, returns settings in flat format.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • preserve_existing (bool | None) – If true, existing index settings remain unchanged.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_template(*, name, aliases=None, create=None, error_trace=None, filter_path=None, flat_settings=None, human=None, index_patterns=None, mappings=None, master_timeout=None, order=None, pretty=None, settings=None, timeout=None, version=None)

Creates or updates an index template.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str) – The name of the template

  • aliases (Mapping[str, Mapping[str, Any]] | None) – Aliases for the index.

  • create (bool | None) – If true, this request cannot replace or update existing index templates.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • index_patterns (str | Sequence[str] | None) – Array of wildcard expressions used to match the names of indices during creation.

  • mappings (Mapping[str, Any] | None) – Mapping for fields in the index.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • order (int | None) – Order in which Elasticsearch applies this template if index matches multiple templates. Templates with lower ‘order’ values are merged first. Templates with higher ‘order’ values are merged later, overriding templates with lower values.

  • settings (Mapping[str, Any] | None) – Configuration options for the index.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • version (int | None) – Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

recovery(*, index=None, active_only=None, detailed=None, error_trace=None, filter_path=None, human=None, pretty=None)

Returns information about ongoing index shard recoveries.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-recovery.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

  • active_only (bool | None) – If true, the response only includes ongoing shard recoveries.

  • detailed (bool | None) – If true, the response includes detailed information about shard recoveries.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

refresh(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, pretty=None)

Performs the refresh operation in one or more indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-refresh.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

reload_search_analyzers(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, pretty=None)

Reloads an index’s search analyzers and their resources.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-reload-analyzers.html

Parameters:
  • index (str | Sequence[str]) – A comma-separated list of index names to reload analyzers for

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

resolve_index(*, name, error_trace=None, expand_wildcards=None, filter_path=None, human=None, pretty=None)

Returns information about any matching indices, aliases, and data streams

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-resolve-index-api.html

Parameters:
  • name (str | Sequence[str]) – Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified using the <cluster>:<name> syntax.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

rollover(*, alias, new_index=None, aliases=None, conditions=None, dry_run=None, error_trace=None, filter_path=None, human=None, mappings=None, master_timeout=None, pretty=None, settings=None, timeout=None, wait_for_active_shards=None)

Updates an alias to point to a new index when the existing index is considered to be too large or too old.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-rollover-index.html

Parameters:
  • alias (str) – Name of the data stream or index alias to roll over.

  • new_index (str | None) – Name of the index to create. Supports date math. Data streams do not support this parameter.

  • aliases (Mapping[str, Mapping[str, Any]] | None) – Aliases for the target index. Data streams do not support this parameter.

  • conditions (Mapping[str, Any] | None) – Conditions for the rollover. If specified, Elasticsearch only performs the rollover if the current index satisfies these conditions. If this parameter is not specified, Elasticsearch performs the rollover unconditionally. If conditions are specified, at least one of them must be a max_* condition. The index will rollover if any max_* condition is satisfied and all min_* conditions are satisfied.

  • dry_run (bool | None) – If true, checks whether the current index satisfies the specified conditions but does not perform a rollover.

  • mappings (Mapping[str, Any] | None) – Mapping for fields in the index. If specified, this mapping can include field names, field data types, and mapping paramaters.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • settings (Mapping[str, Any] | None) – Configuration options for the index. Data streams do not support this parameter.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

segments(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, pretty=None, verbose=None)

Provides low-level information about segments in a Lucene index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-segments.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • verbose (bool | None) – If true, the request returns a verbose response.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

shard_stores(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, pretty=None, status=None)

Provides store information for shard copies of indices.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-shards-stores.html

Parameters:
  • index (str | Sequence[str] | None) – List of data streams, indices, and aliases used to limit the request.

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

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.

  • ignore_unavailable (bool | None) – If true, missing or closed indices are not included in the response.

  • status (Sequence[Literal['all', 'green', 'red', 'yellow'] | str] | ~typing.Literal['all', 'green', 'red', 'yellow'] | str | None) – List of shard health statuses used to limit the request.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

shrink(*, index, target, aliases=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, settings=None, timeout=None, wait_for_active_shards=None)

Allow to shrink an existing index into a new index with fewer primary shards.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-shrink-index.html

Parameters:
  • index (str) – Name of the source index to shrink.

  • target (str) – Name of the target index to create.

  • aliases (Mapping[str, Mapping[str, Any]] | None) – The key is the alias name. Index alias names support date math.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • settings (Mapping[str, Any] | None) – Configuration options for the target index.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

simulate_index_template(*, name, allow_auto_create=None, composed_of=None, create=None, data_stream=None, error_trace=None, filter_path=None, human=None, include_defaults=None, index_patterns=None, master_timeout=None, meta=None, pretty=None, priority=None, template=None, version=None)

Simulate matching the given index name against the index templates in the system

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str) – Index or template name to simulate

  • allow_auto_create (bool | None) – This setting overrides the value of the action.auto_create_index cluster setting. If set to true in a template, then indices can be automatically created using that template even if auto-creation of indices is disabled via actions.auto_create_index. If set to false, then indices or data streams matching the template must always be explicitly created, and may never be automatically created.

  • composed_of (Sequence[str] | None) – An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence.

  • create (bool | None) – If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation.

  • data_stream (Mapping[str, Any] | None) – If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. Data streams require a matching index template with a data_stream object.

  • include_defaults (bool | None) – If true, returns all relevant default configurations for the index template.

  • index_patterns (str | Sequence[str] | None) – Array of wildcard (*) expressions used to match the names of data streams and indices during creation.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • meta (Mapping[str, Any] | None) – Optional user metadata about the index template. May have any contents. This map is not automatically generated by Elasticsearch.

  • priority (int | None) – Priority to determine index template precedence when a new data stream or index is created. The index template with the highest priority is chosen. If no priority is specified the template is treated as though it is of priority 0 (lowest priority). This number is not automatically generated by Elasticsearch.

  • template (Mapping[str, Any] | None) – Template to be applied. It may optionally include an aliases, mappings, or settings configuration.

  • version (int | None) – Version number used to manage index templates externally. This number is not automatically generated by Elasticsearch.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

simulate_template(*, name=None, create=None, error_trace=None, filter_path=None, human=None, include_defaults=None, master_timeout=None, pretty=None, template=None)

Simulate resolving the given template name or body

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-templates.html

Parameters:
  • name (str | None) – Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter and specify the template configuration in the request body.

  • create (bool | None) – If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation.

  • include_defaults (bool | None) – If true, returns all relevant default configurations for the index template.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • template (Mapping[str, Any] | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

split(*, index, target, aliases=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, settings=None, timeout=None, wait_for_active_shards=None)

Allows you to split an existing index into a new index with more primary shards.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-split-index.html

Parameters:
  • index (str) – Name of the source index to split.

  • target (str) – Name of the target index to create.

  • aliases (Mapping[str, Mapping[str, Any]] | None) – Aliases for the resulting index.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • settings (Mapping[str, Any] | None) – Configuration options for the target index.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (int | Literal['all', 'index-setting'] | str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stats(*, index=None, metric=None, completion_fields=None, error_trace=None, expand_wildcards=None, fielddata_fields=None, fields=None, filter_path=None, forbid_closed_indices=None, groups=None, human=None, include_segment_file_sizes=None, include_unloaded_segments=None, level=None, pretty=None)

Provides statistics on operations happening in an index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-stats.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of index names; use _all or empty string to perform the operation on all indices

  • metric (str | Sequence[str] | None) – Limit the information returned the specific metrics.

  • completion_fields (str | Sequence[str] | None) – Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden.

  • fielddata_fields (str | Sequence[str] | None) – Comma-separated list or wildcard expressions of fields to include in fielddata statistics.

  • fields (str | Sequence[str] | None) – Comma-separated list or wildcard expressions of fields to include in the statistics.

  • forbid_closed_indices (bool | None) – If true, statistics are not collected from closed indices.

  • groups (str | Sequence[str] | None) – Comma-separated list of search groups to include in the search statistics.

  • include_segment_file_sizes (bool | None) – If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).

  • include_unloaded_segments (bool | None) – If true, the response includes information from segments that are not loaded into memory.

  • level (Literal['cluster', 'indices', 'shards'] | str | None) – Indicates whether statistics are aggregated at the cluster, index, or shard level.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

unfreeze(*, index, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, pretty=None, timeout=None, wait_for_active_shards=None)

Unfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/unfreeze-index-api.html

Parameters:
  • index (str) – Identifier for the 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.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_active_shards (str | None) – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1).

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_aliases(*, actions=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Updates index aliases.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/indices-aliases.html

Parameters:
  • actions (Sequence[Mapping[str, Any]] | None) – Actions to perform.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

validate_query(*, index=None, all_shards=None, allow_no_indices=None, analyze_wildcard=None, analyzer=None, default_operator=None, df=None, error_trace=None, expand_wildcards=None, explain=None, filter_path=None, human=None, ignore_unavailable=None, lenient=None, pretty=None, q=None, query=None, rewrite=None)

Allows a user to validate a potentially expensive query without executing it.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-validate.html

Parameters:
  • index (str | Sequence[str] | None) – Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*). To search all data streams or indices, omit this parameter or use * or _all.

  • all_shards (bool | None) – If true, the validation is executed on all shards instead of one random shard per 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.

  • analyze_wildcard (bool | None) – If true, wildcard and prefix queries are analyzed.

  • analyzer (str | None) – Analyzer to use for the query string. This parameter can only be used when the q query string parameter is specified.

  • default_operator (Literal['and', 'or'] | str | None) – The default operator for query string query: AND or OR.

  • df (str | None) – Field to use as default where no field prefix is given in the query string. This parameter can only be used when the q query string parameter is specified.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: all, open, closed, hidden, none.

  • explain (bool | None) – If true, the response returns detailed information if an error has occurred.

  • ignore_unavailable (bool | None) – If false, the request returns an error if it targets a missing or closed index.

  • lenient (bool | None) – If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.

  • q (str | None) – Query in the Lucene query string syntax.

  • query (Mapping[str, Any] | None) – Query in the Lucene query string syntax.

  • rewrite (bool | None) – If true, returns a more detailed explanation showing the actual Lucene query that will be executed.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Ingest Pipelines

class elasticsearch.client.IngestClient(client)
Parameters:

client (BaseClient) –

delete_pipeline(*, id, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes a pipeline.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-pipeline-api.html

Parameters:
  • id (str) – Pipeline ID or wildcard expression of pipeline IDs used to limit the request. To delete all ingest pipelines in a cluster, use a value of *.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

geo_ip_stats(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns statistical information about geoip databases

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/geoip-processor.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_pipeline(*, id=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, summary=None)

Returns a pipeline.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-pipeline-api.html

Parameters:
  • id (str | None) – Comma-separated list of pipeline IDs to retrieve. Wildcard (*) expressions are supported. To get all ingest pipelines, omit this parameter or use *.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • summary (bool | None) – Return pipelines without their definitions (default: false)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

processor_grok(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns a list of the built-in patterns.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/grok-processor.html

Parameters:
Return type:

ObjectApiResponse[Any]

put_pipeline(*, id, description=None, error_trace=None, filter_path=None, human=None, if_version=None, master_timeout=None, meta=None, on_failure=None, pretty=None, processors=None, timeout=None, version=None)

Creates or updates a pipeline.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ingest.html

Parameters:
  • id (str) – ID of the ingest pipeline to create or update.

  • description (str | None) – Description of the ingest pipeline.

  • if_version (int | None) – Required version for optimistic concurrency control for pipeline updates

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • meta (Mapping[str, Any] | None) – Optional metadata about the ingest pipeline. May have any contents. This map is not automatically generated by Elasticsearch.

  • on_failure (Sequence[Mapping[str, Any]] | None) – Processors to run immediately after a processor failure. Each processor supports a processor-level on_failure value. If a processor without an on_failure value fails, Elasticsearch uses this pipeline-level parameter as a fallback. The processors in this parameter run sequentially in the order specified. Elasticsearch will not attempt to run the pipeline’s remaining processors.

  • processors (Sequence[Mapping[str, Any]] | None) – Processors used to perform transformations on documents before indexing. Processors run sequentially in the order specified.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • version (int | None) – Version number used by external systems to track ingest pipelines. This parameter is intended for external systems only. Elasticsearch does not use or validate pipeline version numbers.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

simulate(*, id=None, docs=None, error_trace=None, filter_path=None, human=None, pipeline=None, pretty=None, verbose=None)

Allows to simulate a pipeline with example documents.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/simulate-pipeline-api.html

Parameters:
  • id (str | None) – Pipeline to test. If you don’t specify a pipeline in the request body, this parameter is required.

  • docs (Sequence[Mapping[str, Any]] | None) – Sample documents to test in the pipeline.

  • pipeline (Mapping[str, Any] | None) – Pipeline to test. If you don’t specify the pipeline request path parameter, this parameter is required. If you specify both this and the request path parameter, the API only uses the request path parameter.

  • verbose (bool | None) – If true, the response includes output data for each processor in the executed pipeline.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

License

class elasticsearch.client.LicenseClient(client)
Parameters:

client (BaseClient) –

delete(*, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes licensing information for the cluster

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-license.html

Parameters:
Return type:

ObjectApiResponse[Any]

get(*, accept_enterprise=None, error_trace=None, filter_path=None, human=None, local=None, pretty=None)

Retrieves licensing information for the cluster

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-license.html

Parameters:
  • accept_enterprise (bool | None) – If true, this parameter returns enterprise for Enterprise license types. If false, this parameter returns platinum for both platinum and enterprise license types. This behavior is maintained for backwards compatibility. This parameter is deprecated and will always be set to true in 8.x.

  • local (bool | None) – Specifies whether to retrieve local information. The default value is false, which means the information is retrieved from the master node.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_basic_status(*, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information about the status of the basic license.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-basic-status.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_trial_status(*, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information about the status of the trial license.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-trial-status.html

Parameters:
Return type:

ObjectApiResponse[Any]

post(*, acknowledge=None, error_trace=None, filter_path=None, human=None, license=None, licenses=None, pretty=None)

Updates the license for the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/update-license.html

Parameters:
  • acknowledge (bool | None) – Specifies whether you acknowledge the license changes.

  • license (Mapping[str, Any] | None) –

  • licenses (Sequence[Mapping[str, Any]] | None) – A sequence of one or more JSON documents containing the license information.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

post_start_basic(*, acknowledge=None, error_trace=None, filter_path=None, human=None, pretty=None)

Starts an indefinite basic license.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/start-basic.html

Parameters:
  • acknowledge (bool | None) – whether the user has acknowledged acknowledge messages (default: false)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

post_start_trial(*, acknowledge=None, error_trace=None, filter_path=None, human=None, pretty=None, type_query_string=None)

starts a limited time trial license.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/start-trial.html

Parameters:
  • acknowledge (bool | None) – whether the user has acknowledged acknowledge messages (default: false)

  • type_query_string (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Logstash

class elasticsearch.client.LogstashClient(client)
Parameters:

client (BaseClient) –

delete_pipeline(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes Logstash Pipelines used by Central Management

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/logstash-api-delete-pipeline.html

Parameters:
  • id (str) – Identifier for the pipeline.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_pipeline(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves Logstash Pipelines used by Central Management

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/logstash-api-get-pipeline.html

Parameters:
  • id (str | Sequence[str]) – Comma-separated list of pipeline identifiers.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_pipeline(*, id, pipeline, error_trace=None, filter_path=None, human=None, pretty=None)

Adds and updates Logstash Pipelines used for Central Management

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/logstash-api-put-pipeline.html

Parameters:
Return type:

ObjectApiResponse[Any]

Migration

class elasticsearch.client.MigrationClient(client)
Parameters:

client (BaseClient) –

deprecations(*, index=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information about different cluster, node, and index level settings that use deprecated features that will be removed or changed in the next major version.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/migration-api-deprecation.html

Parameters:
  • index (str | None) – Comma-separate list of data streams or indices to check. Wildcard (*) expressions are supported.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_feature_upgrade_status(*, error_trace=None, filter_path=None, human=None, pretty=None)

Find out whether system features need to be upgraded or not

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/migration-api-feature-upgrade.html

Parameters:
Return type:

ObjectApiResponse[Any]

post_feature_upgrade(*, error_trace=None, filter_path=None, human=None, pretty=None)

Begin upgrades for system features

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/migration-api-feature-upgrade.html

Parameters:
Return type:

ObjectApiResponse[Any]

Machine Learning (ML)

class elasticsearch.client.MlClient(client)
Parameters:

client (BaseClient) –

clear_trained_model_deployment_cache(*, model_id, error_trace=None, filter_path=None, human=None, pretty=None)

Clear the cached results from a trained model deployment

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/clear-trained-model-deployment-cache.html

Parameters:
  • model_id (str) – The unique identifier of the trained model.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

close_job(*, job_id, allow_no_match=None, error_trace=None, filter_path=None, force=None, human=None, pretty=None, timeout=None)

Closes one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-close-job.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. You can close multiple anomaly detection jobs in a single API request by using a group name, a comma-separated list of jobs, or a wildcard expression. You can close all jobs by using _all or by specifying * as the job identifier.

  • allow_no_match (bool | None) – Refer to the description for the allow_no_match query parameter.

  • force (bool | None) – Refer to the descriptiion for the force query parameter.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Refer to the description for the timeout query parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_calendar(*, calendar_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a calendar.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-calendar.html

Parameters:
  • calendar_id (str) – A string that uniquely identifies a calendar.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_calendar_event(*, calendar_id, event_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes scheduled events from a calendar.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-calendar-event.html

Parameters:
  • calendar_id (str) – The ID of the calendar to modify

  • event_id (str) – The ID of the event to remove from the calendar

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_calendar_job(*, calendar_id, job_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes anomaly detection jobs from a calendar.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-calendar-job.html

Parameters:
  • calendar_id (str) – A string that uniquely identifies a calendar.

  • job_id (str | Sequence[str]) – An identifier for the anomaly detection jobs. It can be a job identifier, a group name, or a comma-separated list of jobs or groups.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_data_frame_analytics(*, id, error_trace=None, filter_path=None, force=None, human=None, pretty=None, timeout=None)

Deletes an existing data frame analytics job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-dfanalytics.html

Parameters:
  • id (str) – Identifier for the data frame analytics job.

  • force (bool | None) – If true, it deletes a job that is not stopped; this method is quicker than stopping and deleting the job.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – The time to wait for the job to be deleted.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_datafeed(*, datafeed_id, error_trace=None, filter_path=None, force=None, human=None, pretty=None)

Deletes an existing datafeed.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-datafeed.html

Parameters:
  • datafeed_id (str) – A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • force (bool | None) – Use to forcefully delete a started datafeed; this method is quicker than stopping and deleting the datafeed.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_expired_data(*, job_id=None, error_trace=None, filter_path=None, human=None, pretty=None, requests_per_second=None, timeout=None)

Deletes expired and unused machine learning data.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-expired-data.html

Parameters:
  • job_id (str | None) – Identifier for an anomaly detection job. It can be a job identifier, a group name, or a wildcard expression.

  • requests_per_second (float | None) – The desired requests per second for the deletion processes. The default behavior is no throttling.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – How long can the underlying delete processes run until they are canceled.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_filter(*, filter_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a filter.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-filter.html

Parameters:
  • filter_id (str) – A string that uniquely identifies a filter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_forecast(*, job_id, forecast_id=None, allow_no_forecasts=None, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None)

Deletes forecasts from a machine learning job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-forecast.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • forecast_id (str | None) – A comma-separated list of forecast identifiers. If you do not specify this optional parameter or if you specify _all or * the API deletes all forecasts from the job.

  • allow_no_forecasts (bool | None) – Specifies whether an error occurs when there are no forecasts. In particular, if this parameter is set to false and there are no forecasts associated with the job, attempts to delete all forecasts return an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specifies the period of time to wait for the completion of the delete operation. When this period of time elapses, the API fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_job(*, job_id, delete_user_annotations=None, error_trace=None, filter_path=None, force=None, human=None, pretty=None, wait_for_completion=None)

Deletes an existing anomaly detection job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-job.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • delete_user_annotations (bool | None) – Specifies whether annotations that have been added by the user should be deleted along with any auto-generated annotations when the job is reset.

  • force (bool | None) – Use to forcefully delete an opened job; this method is quicker than closing and deleting the job.

  • wait_for_completion (bool | None) – Specifies whether the request should return immediately or wait until the job deletion completes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_model_snapshot(*, job_id, snapshot_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes an existing model snapshot.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-delete-snapshot.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • snapshot_id (str) – Identifier for the model snapshot.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_trained_model(*, model_id, error_trace=None, filter_path=None, force=None, human=None, pretty=None)

Deletes an existing trained inference model that is currently not referenced by an ingest pipeline.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-trained-models.html

Parameters:
  • model_id (str) – The unique identifier of the trained model.

  • force (bool | None) – Forcefully deletes a trained model that is referenced by ingest pipelines or has a started deployment.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_trained_model_alias(*, model_id, model_alias, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a model alias that refers to the trained model

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-trained-models-aliases.html

Parameters:
  • model_id (str) – The trained model ID to which the model alias refers.

  • model_alias (str) – The model alias to delete.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

estimate_model_memory(*, analysis_config=None, error_trace=None, filter_path=None, human=None, max_bucket_cardinality=None, overall_cardinality=None, pretty=None)

Estimates the model memory

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-apis.html

Parameters:
  • analysis_config (Mapping[str, Any] | None) – For a list of the properties that you can specify in the analysis_config component of the body of this API.

  • max_bucket_cardinality (Mapping[str, int] | None) – Estimates of the highest cardinality in a single bucket that is observed for influencer fields over the time period that the job analyzes data. To produce a good answer, values must be provided for all influencer fields. Providing values for fields that are not listed as influencers has no effect on the estimation.

  • overall_cardinality (Mapping[str, int] | None) – Estimates of the cardinality that is observed for fields over the whole time period that the job analyzes data. To produce a good answer, values must be provided for fields referenced in the by_field_name, over_field_name and partition_field_name of any detectors. Providing values for other fields has no effect on the estimation. It can be omitted from the request if no detectors have a by_field_name, over_field_name or partition_field_name.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

evaluate_data_frame(*, evaluation, index, error_trace=None, filter_path=None, human=None, pretty=None, query=None)

Evaluates the data frame analytics for an annotated index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/evaluate-dfanalytics.html

Parameters:
  • evaluation (Mapping[str, Any]) – Defines the type of evaluation you want to perform.

  • index (str) – Defines the index in which the evaluation will be performed.

  • query (Mapping[str, Any] | None) – A query clause that retrieves a subset of data from the source index.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

explain_data_frame_analytics(*, id=None, allow_lazy_start=None, analysis=None, analyzed_fields=None, description=None, dest=None, error_trace=None, filter_path=None, human=None, max_num_threads=None, model_memory_limit=None, pretty=None, source=None)

Explains a data frame analytics config.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/explain-dfanalytics.html

Parameters:
  • id (str | None) – Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • allow_lazy_start (bool | None) – Specifies whether this job can start when there is insufficient machine learning node capacity for it to be immediately assigned to a node.

  • analysis (Mapping[str, Any] | None) – The analysis configuration, which contains the information necessary to perform one of the following types of analysis: classification, outlier detection, or regression.

  • analyzed_fields (Mapping[str, Any] | None) – Specify includes and/or excludes patterns to select which fields will be included in the analysis. The patterns specified in excludes are applied last, therefore excludes takes precedence. In other words, if the same field is specified in both includes and excludes, then the field will not be included in the analysis.

  • description (str | None) – A description of the job.

  • dest (Mapping[str, Any] | None) – The destination configuration, consisting of index and optionally results_field (ml by default).

  • max_num_threads (int | None) – The maximum number of threads to be used by the analysis. Using more threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself.

  • model_memory_limit (str | None) – The approximate maximum amount of memory resources that are permitted for analytical processing. If your elasticsearch.yml file contains an xpack.ml.max_model_memory_limit setting, an error occurs when you try to create data frame analytics jobs that have model_memory_limit values greater than that setting.

  • source (Mapping[str, Any] | None) – The configuration of how to source the analysis data. It requires an index. Optionally, query and _source may be specified.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

flush_job(*, job_id, advance_time=None, calc_interim=None, end=None, error_trace=None, filter_path=None, human=None, pretty=None, skip_time=None, start=None)

Forces any buffered data to be processed by the job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-flush-job.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • advance_time (str | Any | None) – Refer to the description for the advance_time query parameter.

  • calc_interim (bool | None) – Refer to the description for the calc_interim query parameter.

  • end (str | Any | None) – Refer to the description for the end query parameter.

  • skip_time (str | Any | None) – Refer to the description for the skip_time query parameter.

  • start (str | Any | None) – Refer to the description for the start query parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

forecast(*, job_id, duration=None, error_trace=None, expires_in=None, filter_path=None, human=None, max_model_memory=None, pretty=None)

Predicts the future behavior of a time series by using its historical behavior.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-forecast.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job. The job must be open when you create a forecast; otherwise, an error occurs.

  • duration (Literal[-1] | ~typing.Literal[0] | str | None) – Refer to the description for the duration query parameter.

  • expires_in (Literal[-1] | ~typing.Literal[0] | str | None) – Refer to the description for the expires_in query parameter.

  • max_model_memory (str | None) – Refer to the description for the max_model_memory query parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_buckets(*, job_id, timestamp=None, anomaly_score=None, desc=None, end=None, error_trace=None, exclude_interim=None, expand=None, filter_path=None, from_=None, human=None, page=None, pretty=None, size=None, sort=None, start=None)

Retrieves anomaly detection job results for one or more buckets.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-bucket.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • timestamp (str | Any | None) – The timestamp of a single bucket result. If you do not specify this parameter, the API returns information about all buckets.

  • anomaly_score (float | None) – Refer to the description for the anomaly_score query parameter.

  • desc (bool | None) – Refer to the description for the desc query parameter.

  • end (str | Any | None) – Refer to the description for the end query parameter.

  • exclude_interim (bool | None) – Refer to the description for the exclude_interim query parameter.

  • expand (bool | None) – Refer to the description for the expand query parameter.

  • from – Skips the specified number of buckets.

  • page (Mapping[str, Any] | None) –

  • size (int | None) – Specifies the maximum number of buckets to obtain.

  • sort (str | None) – Refer to the desription for the sort query parameter.

  • start (str | Any | None) – Refer to the description for the start query parameter.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_calendar_events(*, calendar_id, end=None, error_trace=None, filter_path=None, from_=None, human=None, job_id=None, pretty=None, size=None, start=None)

Retrieves information about the scheduled events in calendars.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-calendar-event.html

Parameters:
  • calendar_id (str) – A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using _all or * or by omitting the calendar identifier.

  • end (str | Any | None) – Specifies to get events with timestamps earlier than this time.

  • from – Skips the specified number of events.

  • job_id (str | None) – Specifies to get events for a specific anomaly detection job identifier or job group. It must be used with a calendar identifier of _all or *.

  • size (int | None) – Specifies the maximum number of events to obtain.

  • start (str | Any | None) – Specifies to get events with timestamps after this time.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_calendars(*, calendar_id=None, error_trace=None, filter_path=None, from_=None, human=None, page=None, pretty=None, size=None)

Retrieves configuration information for calendars.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-calendar.html

Parameters:
  • calendar_id (str | None) – A string that uniquely identifies a calendar. You can get information for multiple calendars by using a comma-separated list of ids or a wildcard expression. You can get information for all calendars by using _all or * or by omitting the calendar identifier.

  • from – Skips the specified number of calendars. This parameter is supported only when you omit the calendar identifier.

  • page (Mapping[str, Any] | None) – This object is supported only when you omit the calendar identifier.

  • size (int | None) – Specifies the maximum number of calendars to obtain. This parameter is supported only when you omit the calendar identifier.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_categories(*, job_id, category_id=None, error_trace=None, filter_path=None, from_=None, human=None, page=None, partition_field_value=None, pretty=None, size=None)

Retrieves anomaly detection job results for one or more categories.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-category.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • category_id (str | None) – Identifier for the category, which is unique in the job. If you specify neither the category ID nor the partition_field_value, the API returns information about all categories. If you specify only the partition_field_value, it returns information about all categories for the specified partition.

  • from – Skips the specified number of categories.

  • page (Mapping[str, Any] | None) –

  • partition_field_value (str | None) – Only return categories for the specified partition.

  • size (int | None) – Specifies the maximum number of categories to obtain.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_data_frame_analytics(*, id=None, allow_no_match=None, error_trace=None, exclude_generated=None, filter_path=None, from_=None, human=None, pretty=None, size=None)

Retrieves configuration information for data frame analytics jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-dfanalytics.html

Parameters:
  • id (str | None) – Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame analytics jobs.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no data frame analytics jobs that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • exclude_generated (bool | None) – Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster.

  • from – Skips the specified number of data frame analytics jobs.

  • size (int | None) – Specifies the maximum number of data frame analytics jobs to obtain.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_data_frame_analytics_stats(*, id=None, allow_no_match=None, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None, verbose=None)

Retrieves usage information for data frame analytics jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-dfanalytics-stats.html

Parameters:
  • id (str | None) – Identifier for the data frame analytics job. If you do not specify this option, the API returns information for the first hundred data frame analytics jobs.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no data frame analytics jobs that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • from – Skips the specified number of data frame analytics jobs.

  • size (int | None) – Specifies the maximum number of data frame analytics jobs to obtain.

  • verbose (bool | None) – Defines whether the stats response should be verbose.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_datafeed_stats(*, datafeed_id=None, allow_no_match=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves usage information for datafeeds.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-datafeed-stats.html

Parameters:
  • datafeed_id (str | Sequence[str] | None) – Identifier for the datafeed. It can be a datafeed identifier or a wildcard expression. If you do not specify one of these options, the API returns information about all datafeeds.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no datafeeds that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty datafeeds array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_datafeeds(*, datafeed_id=None, allow_no_match=None, error_trace=None, exclude_generated=None, filter_path=None, human=None, pretty=None)

Retrieves configuration information for datafeeds.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-datafeed.html

Parameters:
  • datafeed_id (str | Sequence[str] | None) – Identifier for the datafeed. It can be a datafeed identifier or a wildcard expression. If you do not specify one of these options, the API returns information about all datafeeds.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no datafeeds that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty datafeeds array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • exclude_generated (bool | None) – Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_filters(*, filter_id=None, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None)

Retrieves filters.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-filter.html

Parameters:
  • filter_id (str | Sequence[str] | None) – A string that uniquely identifies a filter.

  • from – Skips the specified number of filters.

  • size (int | None) – Specifies the maximum number of filters to obtain.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_influencers(*, job_id, desc=None, end=None, error_trace=None, exclude_interim=None, filter_path=None, from_=None, human=None, influencer_score=None, page=None, pretty=None, size=None, sort=None, start=None)

Retrieves anomaly detection job results for one or more influencers.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-influencer.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • desc (bool | None) – If true, the results are sorted in descending order.

  • end (str | Any | None) – Returns influencers with timestamps earlier than this time. The default value means it is unset and results are not limited to specific timestamps.

  • exclude_interim (bool | None) – If true, the output excludes interim results. By default, interim results are included.

  • from – Skips the specified number of influencers.

  • influencer_score (float | None) – Returns influencers with anomaly scores greater than or equal to this value.

  • page (Mapping[str, Any] | None) –

  • size (int | None) – Specifies the maximum number of influencers to obtain.

  • sort (str | None) – Specifies the sort field for the requested influencers. By default, the influencers are sorted by the influencer_score value.

  • start (str | Any | None) – Returns influencers with timestamps after this time. The default value means it is unset and results are not limited to specific timestamps.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_job_stats(*, job_id=None, allow_no_match=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves usage information for anomaly detection jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-job-stats.html

Parameters:
  • job_id (str | None) – Identifier for the anomaly detection job. It can be a job identifier, a group name, a comma-separated list of jobs, or a wildcard expression. If you do not specify one of these options, the API returns information for all anomaly detection jobs.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no jobs that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. If true, the API returns an empty jobs array when there are no matches and the subset of results when there are partial matches. If false, the API returns a 404 status code when there are no matches or only partial matches.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_jobs(*, job_id=None, allow_no_match=None, error_trace=None, exclude_generated=None, filter_path=None, human=None, pretty=None)

Retrieves configuration information for anomaly detection jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-job.html

Parameters:
  • job_id (str | Sequence[str] | None) – Identifier for the anomaly detection job. It can be a job identifier, a group name, or a wildcard expression. If you do not specify one of these options, the API returns information for all anomaly detection jobs.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no jobs that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty jobs array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • exclude_generated (bool | None) – Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_memory_stats(*, node_id=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Returns information on how ML is using memory.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-ml-memory.html

Parameters:
  • node_id (str | None) – The names of particular nodes in the cluster to target. For example, nodeId1,nodeId2 or ml:true

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_model_snapshot_upgrade_stats(*, job_id, snapshot_id, allow_no_match=None, error_trace=None, filter_path=None, human=None, pretty=None)

Gets stats for anomaly detection job model snapshot upgrades that are in progress.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-job-model-snapshot-upgrade-stats.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • snapshot_id (str) – A numerical character string that uniquely identifies the model snapshot. You can get information for multiple snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using _all, by specifying * as the snapshot ID, or by omitting the snapshot ID.

  • allow_no_match (bool | None) – Specifies what to do when the request: - Contains wildcard expressions and there are no jobs that match. - Contains the _all string or no identifiers and there are no matches. - Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty jobs array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_model_snapshots(*, job_id, snapshot_id=None, desc=None, end=None, error_trace=None, filter_path=None, from_=None, human=None, page=None, pretty=None, size=None, sort=None, start=None)

Retrieves information about model snapshots.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-snapshot.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • snapshot_id (str | None) – A numerical character string that uniquely identifies the model snapshot. You can get information for multiple snapshots by using a comma-separated list or a wildcard expression. You can get all snapshots by using _all, by specifying * as the snapshot ID, or by omitting the snapshot ID.

  • desc (bool | None) – Refer to the description for the desc query parameter.

  • end (str | Any | None) – Refer to the description for the end query parameter.

  • from – Skips the specified number of snapshots.

  • page (Mapping[str, Any] | None) –

  • size (int | None) – Specifies the maximum number of snapshots to obtain.

  • sort (str | None) – Refer to the description for the sort query parameter.

  • start (str | Any | None) – Refer to the description for the start query parameter.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_overall_buckets(*, job_id, allow_no_match=None, bucket_span=None, end=None, error_trace=None, exclude_interim=None, filter_path=None, human=None, overall_score=None, pretty=None, start=None, top_n=None)

Retrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-overall-buckets.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job. It can be a job identifier, a group name, a comma-separated list of jobs or groups, or a wildcard expression. You can summarize the bucket results for all anomaly detection jobs by using _all or by specifying * as the <job_id>.

  • allow_no_match (bool | None) – Refer to the description for the allow_no_match query parameter.

  • bucket_span (Literal[-1] | ~typing.Literal[0] | str | None) – Refer to the description for the bucket_span query parameter.

  • end (str | Any | None) – Refer to the description for the end query parameter.

  • exclude_interim (bool | None) – Refer to the description for the exclude_interim query parameter.

  • overall_score (float | str | None) – Refer to the description for the overall_score query parameter.

  • start (str | Any | None) – Refer to the description for the start query parameter.

  • top_n (int | None) – Refer to the description for the top_n query parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_records(*, job_id, desc=None, end=None, error_trace=None, exclude_interim=None, filter_path=None, from_=None, human=None, page=None, pretty=None, record_score=None, size=None, sort=None, start=None)

Retrieves anomaly records for an anomaly detection job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-get-record.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • desc (bool | None) – Refer to the description for the desc query parameter.

  • end (str | Any | None) – Refer to the description for the end query parameter.

  • exclude_interim (bool | None) – Refer to the description for the exclude_interim query parameter.

  • from – Skips the specified number of records.

  • page (Mapping[str, Any] | None) –

  • record_score (float | None) – Refer to the description for the record_score query parameter.

  • size (int | None) – Specifies the maximum number of records to obtain.

  • sort (str | None) – Refer to the description for the sort query parameter.

  • start (str | Any | None) – Refer to the description for the start query parameter.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_trained_models(*, model_id=None, allow_no_match=None, decompress_definition=None, error_trace=None, exclude_generated=None, filter_path=None, from_=None, human=None, include=None, pretty=None, size=None, tags=None)

Retrieves configuration information for a trained inference model.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-trained-models.html

Parameters:
  • model_id (str | None) – The unique identifier of the trained model.

  • allow_no_match (bool | None) – Specifies what to do when the request: - Contains wildcard expressions and there are no models that match. - Contains the _all string or no identifiers and there are no matches. - Contains wildcard expressions and there are only partial matches. If true, it returns an empty array when there are no matches and the subset of results when there are partial matches.

  • decompress_definition (bool | None) – Specifies whether the included model definition should be returned as a JSON map (true) or in a custom compressed format (false).

  • exclude_generated (bool | None) – Indicates if certain fields should be removed from the configuration on retrieval. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster.

  • from – Skips the specified number of models.

  • include (Literal['definition', 'definition_status', 'feature_importance_baseline', 'hyperparameters', 'total_feature_importance'] | str | None) – A comma delimited string of optional fields to include in the response body.

  • size (int | None) – Specifies the maximum number of models to obtain.

  • tags (str | None) – A comma delimited string of tags. A trained model can have many tags, or none. When supplied, only trained models that contain all the supplied tags are returned.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_trained_models_stats(*, model_id=None, allow_no_match=None, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None)

Retrieves usage information for trained inference models.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-trained-models-stats.html

Parameters:
  • model_id (str | Sequence[str] | None) – The unique identifier of the trained model or a model alias. It can be a comma-separated list or a wildcard expression.

  • allow_no_match (bool | None) – Specifies what to do when the request: - Contains wildcard expressions and there are no models that match. - Contains the _all string or no identifiers and there are no matches. - Contains wildcard expressions and there are only partial matches. If true, it returns an empty array when there are no matches and the subset of results when there are partial matches.

  • from – Skips the specified number of models.

  • size (int | None) – Specifies the maximum number of models to obtain.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

infer_trained_model(*, model_id, docs, error_trace=None, filter_path=None, human=None, inference_config=None, pretty=None, timeout=None)

Evaluate a trained model.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/infer-trained-model.html

Parameters:
  • model_id (str) – The unique identifier of the trained model.

  • docs (Sequence[Mapping[str, Any]]) – An array of objects to pass to the model for inference. The objects should contain a fields matching your configured trained model input. Typically, for NLP models, the field name is text_field. Currently, for NLP models, only a single value is allowed.

  • inference_config (Mapping[str, Any] | None) – The inference configuration updates to apply on the API call

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Controls the amount of time to wait for inference results.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

info(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns defaults and limits used by machine learning.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-ml-info.html

Parameters:
Return type:

ObjectApiResponse[Any]

open_job(*, job_id, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None)

Opens one or more anomaly detection jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-open-job.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Refer to the description for the timeout query parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

post_calendar_events(*, calendar_id, events, error_trace=None, filter_path=None, human=None, pretty=None)

Posts scheduled events in a calendar.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-post-calendar-event.html

Parameters:
  • calendar_id (str) – A string that uniquely identifies a calendar.

  • events (Sequence[Mapping[str, Any]]) – A list of one of more scheduled events. The event’s start and end times can be specified as integer milliseconds since the epoch or as a string in ISO 8601 format.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

post_data(*, job_id, data, error_trace=None, filter_path=None, human=None, pretty=None, reset_end=None, reset_start=None)

Sends data to an anomaly detection job for analysis.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-post-data.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job. The job must have a state of open to receive and process the data.

  • data (Sequence[Any]) –

  • reset_end (str | Any | None) – Specifies the end of the bucket resetting range.

  • reset_start (str | Any | None) – Specifies the start of the bucket resetting range.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

preview_data_frame_analytics(*, id=None, config=None, error_trace=None, filter_path=None, human=None, pretty=None)

Previews that will be analyzed given a data frame analytics config.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/preview-dfanalytics.html

Parameters:
  • id (str | None) – Identifier for the data frame analytics job.

  • config (Mapping[str, Any] | None) – A data frame analytics config as described in create data frame analytics jobs. Note that id and dest don’t need to be provided in the context of this API.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

preview_datafeed(*, datafeed_id=None, datafeed_config=None, end=None, error_trace=None, filter_path=None, human=None, job_config=None, pretty=None, start=None)

Previews a datafeed.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-preview-datafeed.html

Parameters:
  • datafeed_id (str | None) – A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters. NOTE: If you use this path parameter, you cannot provide datafeed or anomaly detection job configuration details in the request body.

  • datafeed_config (Mapping[str, Any] | None) – The datafeed definition to preview.

  • end (str | Any | None) – The end time when the datafeed preview should stop

  • job_config (Mapping[str, Any] | None) – The configuration details for the anomaly detection job that is associated with the datafeed. If the datafeed_config object does not include a job_id that references an existing anomaly detection job, you must supply this job_config object. If you include both a job_id and a job_config, the latter information is used. You cannot specify a job_config object unless you also supply a datafeed_config object.

  • start (str | Any | None) – The start time from where the datafeed preview should begin

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_calendar(*, calendar_id, description=None, error_trace=None, filter_path=None, human=None, job_ids=None, pretty=None)

Instantiates a calendar.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-put-calendar.html

Parameters:
  • calendar_id (str) – A string that uniquely identifies a calendar.

  • description (str | None) – A description of the calendar.

  • job_ids (Sequence[str] | None) – An array of anomaly detection job identifiers.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_calendar_job(*, calendar_id, job_id, error_trace=None, filter_path=None, human=None, pretty=None)

Adds an anomaly detection job to a calendar.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-put-calendar-job.html

Parameters:
  • calendar_id (str) – A string that uniquely identifies a calendar.

  • job_id (str) – An identifier for the anomaly detection jobs. It can be a job identifier, a group name, or a comma-separated list of jobs or groups.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_data_frame_analytics(*, id, analysis, dest, source, allow_lazy_start=None, analyzed_fields=None, description=None, error_trace=None, filter_path=None, headers=None, human=None, max_num_threads=None, model_memory_limit=None, pretty=None, version=None)

Instantiates a data frame analytics job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-dfanalytics.html

Parameters:
  • id (str) – Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • analysis (Mapping[str, Any]) – The analysis configuration, which contains the information necessary to perform one of the following types of analysis: classification, outlier detection, or regression.

  • dest (Mapping[str, Any]) – The destination configuration.

  • source (Mapping[str, Any]) – The configuration of how to source the analysis data.

  • allow_lazy_start (bool | None) – Specifies whether this job can start when there is insufficient machine learning node capacity for it to be immediately assigned to a node. If set to false and a machine learning node with capacity to run the job cannot be immediately found, the API returns an error. If set to true, the API does not return an error; the job waits in the starting state until sufficient machine learning node capacity is available. This behavior is also affected by the cluster-wide xpack.ml.max_lazy_ml_nodes setting.

  • analyzed_fields (Mapping[str, Any] | None) – Specifies includes and/or excludes patterns to select which fields will be included in the analysis. The patterns specified in excludes are applied last, therefore excludes takes precedence. In other words, if the same field is specified in both includes and excludes, then the field will not be included in the analysis. If analyzed_fields is not set, only the relevant fields will be included. For example, all the numeric fields for outlier detection. The supported fields vary for each type of analysis. Outlier detection requires numeric or boolean data to analyze. The algorithms don’t support missing values therefore fields that have data types other than numeric or boolean are ignored. Documents where included fields contain missing values, null values, or an array are also ignored. Therefore the dest index may contain documents that don’t have an outlier score. Regression supports fields that are numeric, boolean, text, keyword, and ip data types. It is also tolerant of missing values. Fields that are supported are included in the analysis, other fields are ignored. Documents where included fields contain an array with two or more values are also ignored. Documents in the dest index that don’t contain a results field are not included in the regression analysis. Classification supports fields that are numeric, boolean, text, keyword, and ip data types. It is also tolerant of missing values. Fields that are supported are included in the analysis, other fields are ignored. Documents where included fields contain an array with two or more values are also ignored. Documents in the dest index that don’t contain a results field are not included in the classification analysis. Classification analysis can be improved by mapping ordinal variable values to a single number. For example, in case of age ranges, you can model the values as 0-14 = 0, 15-24 = 1, 25-34 = 2, and so on.

  • description (str | None) – A description of the job.

  • headers (Mapping[str, str | Sequence[str]] | None) –

  • max_num_threads (int | None) – The maximum number of threads to be used by the analysis. Using more threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself.

  • model_memory_limit (str | None) – The approximate maximum amount of memory resources that are permitted for analytical processing. If your elasticsearch.yml file contains an xpack.ml.max_model_memory_limit setting, an error occurs when you try to create data frame analytics jobs that have model_memory_limit values greater than that setting.

  • version (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_datafeed(*, datafeed_id, aggregations=None, allow_no_indices=None, chunking_config=None, delayed_data_check_config=None, error_trace=None, expand_wildcards=None, filter_path=None, frequency=None, headers=None, human=None, ignore_throttled=None, ignore_unavailable=None, indexes=None, indices=None, indices_options=None, job_id=None, max_empty_searches=None, pretty=None, query=None, query_delay=None, runtime_mappings=None, script_fields=None, scroll_size=None)

Instantiates a datafeed.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-put-datafeed.html

Parameters:
  • datafeed_id (str) – A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • aggregations (Mapping[str, Mapping[str, Any]] | None) – If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data.

  • allow_no_indices (bool | None) – If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the _all string or when no indices are specified.

  • chunking_config (Mapping[str, Any] | None) – Datafeeds might be required to search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated; it is an advanced configuration option.

  • delayed_data_check_config (Mapping[str, Any] | None) – Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the query_delay is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values.

  • frequency (Literal[-1] | ~typing.Literal[0] | str | None) – The interval at which scheduled queries are made while the datafeed runs in real time. The default value is either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket span. When frequency is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation.

  • headers (Mapping[str, str | Sequence[str]] | None) –

  • ignore_throttled (bool | None) – If true, concrete, expanded, or aliased indices are ignored when frozen.

  • ignore_unavailable (bool | None) – If true, unavailable indices (missing or closed) are ignored.

  • indexes (str | Sequence[str] | None) – An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the remote_cluster_client role.

  • indices (str | Sequence[str] | None) – An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the remote_cluster_client role.

  • indices_options (Mapping[str, Any] | None) – Specifies index expansion options that are used during search

  • job_id (str | None) – Identifier for the anomaly detection job.

  • max_empty_searches (int | None) – If a real-time datafeed has never seen any data (including during any initial training period), it automatically stops and closes the associated job after this many real-time searches return no documents. In other words, it stops after frequency times max_empty_searches of real-time operation. If not set, a datafeed with no end time that sees no data remains started until it is explicitly stopped. By default, it is not set.

  • query (Mapping[str, Any] | None) – The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch.

  • query_delay (Literal[-1] | ~typing.Literal[0] | str | None) – The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default value is randomly selected between 60s and 120s. This randomness improves the query performance when there are multiple jobs running on the same node.

  • runtime_mappings (Mapping[str, Mapping[str, Any]] | None) – Specifies runtime fields for the datafeed search.

  • script_fields (Mapping[str, Mapping[str, Any]] | None) – Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields.

  • scroll_size (int | None) – The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. The maximum value is the value of index.max_result_window, which is 10,000 by default.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_filter(*, filter_id, description=None, error_trace=None, filter_path=None, human=None, items=None, pretty=None)

Instantiates a filter.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-put-filter.html

Parameters:
  • filter_id (str) – A string that uniquely identifies a filter.

  • description (str | None) – A description of the filter.

  • items (Sequence[str] | None) – The items of the filter. A wildcard * can be used at the beginning or the end of an item. Up to 10000 items are allowed in each filter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_job(*, job_id, analysis_config, data_description, allow_lazy_open=None, analysis_limits=None, background_persist_interval=None, custom_settings=None, daily_model_snapshot_retention_after_days=None, datafeed_config=None, description=None, error_trace=None, filter_path=None, groups=None, human=None, model_plot_config=None, model_snapshot_retention_days=None, pretty=None, renormalization_window_days=None, results_index_name=None, results_retention_days=None)

Instantiates an anomaly detection job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-put-job.html

Parameters:
  • job_id (str) – The identifier for the anomaly detection job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • analysis_config (Mapping[str, Any]) – Specifies how to analyze the data. After you create a job, you cannot change the analysis configuration; all the properties are informational.

  • data_description (Mapping[str, Any]) – Defines the format of the input data when you send data to the job by using the post data API. Note that when configure a datafeed, these properties are automatically set. When data is received via the post data API, it is not stored in Elasticsearch. Only the results for anomaly detection are retained.

  • allow_lazy_open (bool | None) – Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. By default, if a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting. If this option is set to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available.

  • analysis_limits (Mapping[str, Any] | None) – Limits can be applied for the resources required to hold the mathematical models in memory. These limits are approximate and can be set per job. They do not control the memory used by other processes, for example the Elasticsearch Java processes.

  • background_persist_interval (Literal[-1] | ~typing.Literal[0] | str | None) – Advanced configuration option. The time between each periodic persistence of the model. The default value is a randomized value between 3 to 4 hours, which avoids all jobs persisting at exactly the same time. The smallest allowed value is 1 hour. For very large models (several GB), persistence could take 10-20 minutes, so do not set the background_persist_interval value too low.

  • custom_settings (Any | None) – Advanced configuration option. Contains custom meta data about the job.

  • daily_model_snapshot_retention_after_days (int | None) – Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to model_snapshot_retention_days.

  • datafeed_config (Mapping[str, Any] | None) – Defines a datafeed for the anomaly detection job. If Elasticsearch security features are enabled, your datafeed remembers which roles the user who created it had at the time of creation and runs the query using those same roles. If you provide secondary authorization headers, those credentials are used instead.

  • description (str | None) – A description of the job.

  • groups (Sequence[str] | None) – A list of job groups. A job can belong to no groups or many.

  • model_plot_config (Mapping[str, Any] | None) – This advanced configuration option stores model information along with the results. It provides a more detailed view into anomaly detection. If you enable model plot it can add considerable overhead to the performance of the system; it is not feasible for jobs with many entities. Model plot provides a simplified and indicative view of the model and its bounds. It does not display complex features such as multivariate correlations or multimodal data. As such, anomalies may occasionally be reported which cannot be seen in the model plot. Model plot config can be configured when the job is created or updated later. It must be disabled if performance issues are experienced.

  • model_snapshot_retention_days (int | None) – Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies the maximum period of time (in days) that snapshots are retained. This period is relative to the timestamp of the most recent snapshot for this job. By default, snapshots ten days older than the newest snapshot are deleted.

  • renormalization_window_days (int | None) – Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen. The default value is the longer of 30 days or 100 bucket spans.

  • results_index_name (str | None) – A text string that affects the name of the machine learning results index. By default, the job generates an index named .ml-anomalies-shared.

  • results_retention_days (int | None) – Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained. Annotations generated by the system also count as results for retention purposes; they are deleted after the same number of days as results. Annotations added by users are retained forever.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_trained_model(*, model_id, compressed_definition=None, defer_definition_decompression=None, definition=None, description=None, error_trace=None, filter_path=None, human=None, inference_config=None, input=None, metadata=None, model_size_bytes=None, model_type=None, pretty=None, tags=None)

Creates an inference trained model.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-trained-models.html

Parameters:
  • model_id (str) – The unique identifier of the trained model.

  • compressed_definition (str | None) – The compressed (GZipped and Base64 encoded) inference definition of the model. If compressed_definition is specified, then definition cannot be specified.

  • defer_definition_decompression (bool | None) – If set to true and a compressed_definition is provided, the request defers definition decompression and skips relevant validations.

  • definition (Mapping[str, Any] | None) – The inference definition for the model. If definition is specified, then compressed_definition cannot be specified.

  • description (str | None) – A human-readable description of the inference trained model.

  • inference_config (Mapping[str, Any] | None) – The default configuration for inference. This can be either a regression or classification configuration. It must match the underlying definition.trained_model’s target_type. For pre-packaged models such as ELSER the config is not required.

  • input (Mapping[str, Any] | None) – The input field names for the model definition.

  • metadata (Any | None) – An object map that contains metadata about the model.

  • model_size_bytes (int | None) – The estimated memory usage in bytes to keep the trained model in memory. This property is supported only if defer_definition_decompression is true or the model definition is not supplied.

  • model_type (Literal['lang_ident', 'pytorch', 'tree_ensemble'] | str | None) – The model type.

  • tags (Sequence[str] | None) – An array of tags to organize the model.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_trained_model_alias(*, model_id, model_alias, error_trace=None, filter_path=None, human=None, pretty=None, reassign=None)

Creates a new model alias (or reassigns an existing one) to refer to the trained model

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-trained-models-aliases.html

Parameters:
  • model_id (str) – The identifier for the trained model that the alias refers to.

  • model_alias (str) – The alias to create or update. This value cannot end in numbers.

  • reassign (bool | None) – Specifies whether the alias gets reassigned to the specified trained model if it is already assigned to a different model. If the alias is already assigned and this parameter is false, the API returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_trained_model_definition_part(*, model_id, part, definition, total_definition_length, total_parts, error_trace=None, filter_path=None, human=None, pretty=None)

Creates part of a trained model definition

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-trained-model-definition-part.html

Parameters:
  • model_id (str) – The unique identifier of the trained model.

  • part (int) – The definition part number. When the definition is loaded for inference the definition parts are streamed in the order of their part number. The first part must be 0 and the final part must be total_parts - 1.

  • definition (str) – The definition part for the model. Must be a base64 encoded string.

  • total_definition_length (int) – The total uncompressed definition length in bytes. Not base64 encoded.

  • total_parts (int) – The total number of parts that will be uploaded. Must be greater than 0.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_trained_model_vocabulary(*, model_id, vocabulary, error_trace=None, filter_path=None, human=None, merges=None, pretty=None)

Creates a trained model vocabulary

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-trained-model-vocabulary.html

Parameters:
  • model_id (str) – The unique identifier of the trained model.

  • vocabulary (Sequence[str]) – The model vocabulary, which must not be empty.

  • merges (Sequence[str] | None) – The optional model merges if required by the tokenizer.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

reset_job(*, job_id, delete_user_annotations=None, error_trace=None, filter_path=None, human=None, pretty=None, wait_for_completion=None)

Resets an existing anomaly detection job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-reset-job.html

Parameters:
  • job_id (str) – The ID of the job to reset.

  • delete_user_annotations (bool | None) – Specifies whether annotations that have been added by the user should be deleted along with any auto-generated annotations when the job is reset.

  • wait_for_completion (bool | None) – Should this request wait until the operation has completed before returning.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

revert_model_snapshot(*, job_id, snapshot_id, delete_intervening_results=None, error_trace=None, filter_path=None, human=None, pretty=None)

Reverts to a specific snapshot.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-revert-snapshot.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • snapshot_id (str) – You can specify empty as the <snapshot_id>. Reverting to the empty snapshot means the anomaly detection job starts learning a new model from scratch when it is started.

  • delete_intervening_results (bool | None) – Refer to the description for the delete_intervening_results query parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

set_upgrade_mode(*, enabled=None, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None)

Sets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-set-upgrade-mode.html

Parameters:
  • enabled (bool | None) – When true, it enables upgrade_mode which temporarily halts all job and datafeed tasks and prohibits new job and datafeed tasks from starting.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – The time to wait for the request to be completed.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

start_data_frame_analytics(*, id, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None)

Starts a data frame analytics job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/start-dfanalytics.html

Parameters:
  • id (str) – Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Controls the amount of time to wait until the data frame analytics job starts.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

start_datafeed(*, datafeed_id, end=None, error_trace=None, filter_path=None, human=None, pretty=None, start=None, timeout=None)

Starts one or more datafeeds.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-start-datafeed.html

Parameters:
  • datafeed_id (str) – A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • end (str | Any | None) – Refer to the description for the end query parameter.

  • start (str | Any | None) – Refer to the description for the start query parameter.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Refer to the description for the timeout query parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

start_trained_model_deployment(*, model_id, cache_size=None, error_trace=None, filter_path=None, human=None, number_of_allocations=None, pretty=None, priority=None, queue_capacity=None, threads_per_allocation=None, timeout=None, wait_for=None)

Start a trained model deployment.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/start-trained-model-deployment.html

Parameters:
  • model_id (str) – The unique identifier of the trained model. Currently, only PyTorch models are supported.

  • cache_size (int | str | None) – The inference cache size (in memory outside the JVM heap) per node for the model. The default value is the same size as the model_size_bytes. To disable the cache, 0b can be provided.

  • number_of_allocations (int | None) – The number of model allocations on each node where the model is deployed. All allocations on a node share the same copy of the model in memory but use a separate set of threads to evaluate the model. Increasing this value generally increases the throughput. If this setting is greater than the number of hardware threads it will automatically be changed to a value less than the number of hardware threads.

  • priority (Literal['low', 'normal'] | str | None) – The deployment priority.

  • queue_capacity (int | None) – Specifies the number of inference requests that are allowed in the queue. After the number of requests exceeds this value, new requests are rejected with a 429 error.

  • threads_per_allocation (int | None) – Sets the number of threads used by each model allocation during inference. This generally increases the inference speed. The inference process is a compute-bound process; any number greater than the number of available hardware threads on the machine does not increase the inference speed. If this setting is greater than the number of hardware threads it will automatically be changed to a value less than the number of hardware threads.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Specifies the amount of time to wait for the model to deploy.

  • wait_for (Literal['fully_allocated', 'started', 'starting'] | str | None) – Specifies the allocation status to wait for before returning.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stop_data_frame_analytics(*, id, allow_no_match=None, error_trace=None, filter_path=None, force=None, human=None, pretty=None, timeout=None)

Stops one or more data frame analytics jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/stop-dfanalytics.html

Parameters:
  • id (str) – Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no data frame analytics jobs that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. The default value is true, which returns an empty data_frame_analytics array when there are no matches and the subset of results when there are partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • force (bool | None) – If true, the data frame analytics job is stopped forcefully.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Controls the amount of time to wait until the data frame analytics job stops. Defaults to 20 seconds.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stop_datafeed(*, datafeed_id, allow_no_match=None, error_trace=None, filter_path=None, force=None, human=None, pretty=None, timeout=None)

Stops one or more datafeeds.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-stop-datafeed.html

Parameters:
  • datafeed_id (str) – Identifier for the datafeed. You can stop multiple datafeeds in a single API request by using a comma-separated list of datafeeds or a wildcard expression. You can close all datafeeds by using _all or by specifying * as the identifier.

  • allow_no_match (bool | None) – Refer to the description for the allow_no_match query parameter.

  • force (bool | None) – Refer to the description for the force query parameter.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Refer to the description for the timeout query parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stop_trained_model_deployment(*, model_id, allow_no_match=None, error_trace=None, filter_path=None, force=None, human=None, pretty=None)

Stop a trained model deployment.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/stop-trained-model-deployment.html

Parameters:
  • model_id (str) – The unique identifier of the trained model.

  • allow_no_match (bool | None) – Specifies what to do when the request: contains wildcard expressions and there are no deployments that match; contains the _all string or no identifiers and there are no matches; or contains wildcard expressions and there are only partial matches. By default, it returns an empty array when there are no matches and the subset of results when there are partial matches. If false, the request returns a 404 status code when there are no matches or only partial matches.

  • force (bool | None) – Forcefully stops the deployment, even if it is used by ingest pipelines. You can’t use these pipelines until you restart the model deployment.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_data_frame_analytics(*, id, allow_lazy_start=None, description=None, error_trace=None, filter_path=None, human=None, max_num_threads=None, model_memory_limit=None, pretty=None)

Updates certain properties of a data frame analytics job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/update-dfanalytics.html

Parameters:
  • id (str) – Identifier for the data frame analytics job. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • allow_lazy_start (bool | None) – Specifies whether this job can start when there is insufficient machine learning node capacity for it to be immediately assigned to a node.

  • description (str | None) – A description of the job.

  • max_num_threads (int | None) – The maximum number of threads to be used by the analysis. Using more threads may decrease the time necessary to complete the analysis at the cost of using more CPU. Note that the process may use additional threads for operational functionality other than the analysis itself.

  • model_memory_limit (str | None) – The approximate maximum amount of memory resources that are permitted for analytical processing. If your elasticsearch.yml file contains an xpack.ml.max_model_memory_limit setting, an error occurs when you try to create data frame analytics jobs that have model_memory_limit values greater than that setting.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_datafeed(*, datafeed_id, aggregations=None, allow_no_indices=None, chunking_config=None, delayed_data_check_config=None, error_trace=None, expand_wildcards=None, filter_path=None, frequency=None, human=None, ignore_throttled=None, ignore_unavailable=None, indexes=None, indices=None, indices_options=None, job_id=None, max_empty_searches=None, pretty=None, query=None, query_delay=None, runtime_mappings=None, script_fields=None, scroll_size=None)

Updates certain properties of a datafeed.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-update-datafeed.html

Parameters:
  • datafeed_id (str) – A numerical character string that uniquely identifies the datafeed. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start and end with alphanumeric characters.

  • aggregations (Mapping[str, Mapping[str, Any]] | None) – If set, the datafeed performs aggregation searches. Support for aggregations is limited and should be used only with low cardinality data.

  • allow_no_indices (bool | None) – If true, wildcard indices expressions that resolve into no concrete indices are ignored. This includes the _all string or when no indices are specified.

  • chunking_config (Mapping[str, Any] | None) – Datafeeds might search over long time periods, for several months or years. This search is split into time chunks in order to ensure the load on Elasticsearch is managed. Chunking configuration controls how the size of these time chunks are calculated; it is an advanced configuration option.

  • delayed_data_check_config (Mapping[str, Any] | None) – Specifies whether the datafeed checks for missing data and the size of the window. The datafeed can optionally search over indices that have already been read in an effort to determine whether any data has subsequently been added to the index. If missing data is found, it is a good indication that the query_delay is set too low and the data is being indexed after the datafeed has passed that moment in time. This check runs only on real-time datafeeds.

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values. Valid values are: * all: Match any data stream or index, including hidden ones. * closed: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed. * hidden: Match hidden data streams and hidden indices. Must be combined with open, closed, or both. * none: Wildcard patterns are not accepted. * open: Match open, non-hidden indices. Also matches any non-hidden data stream.

  • frequency (Literal[-1] | ~typing.Literal[0] | str | None) – The interval at which scheduled queries are made while the datafeed runs in real time. The default value is either the bucket span for short bucket spans, or, for longer bucket spans, a sensible fraction of the bucket span. When frequency is shorter than the bucket span, interim results for the last (partial) bucket are written then eventually overwritten by the full bucket results. If the datafeed uses aggregations, this value must be divisible by the interval of the date histogram aggregation.

  • ignore_throttled (bool | None) – If true, concrete, expanded or aliased indices are ignored when frozen.

  • ignore_unavailable (bool | None) – If true, unavailable indices (missing or closed) are ignored.

  • indexes (Sequence[str] | None) – An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the remote_cluster_client role.

  • indices (Sequence[str] | None) – An array of index names. Wildcards are supported. If any of the indices are in remote clusters, the machine learning nodes must have the remote_cluster_client role.

  • indices_options (Mapping[str, Any] | None) – Specifies index expansion options that are used during search.

  • job_id (str | None) –

  • max_empty_searches (int | None) – If a real-time datafeed has never seen any data (including during any initial training period), it automatically stops and closes the associated job after this many real-time searches return no documents. In other words, it stops after frequency times max_empty_searches of real-time operation. If not set, a datafeed with no end time that sees no data remains started until it is explicitly stopped. By default, it is not set.

  • query (Mapping[str, Any] | None) – The Elasticsearch query domain-specific language (DSL). This value corresponds to the query object in an Elasticsearch search POST body. All the options that are supported by Elasticsearch can be used, as this object is passed verbatim to Elasticsearch. Note that if you change the query, the analyzed data is also changed. Therefore, the time required to learn might be long and the understandability of the results is unpredictable. If you want to make significant changes to the source data, it is recommended that you clone the job and datafeed and make the amendments in the clone. Let both run in parallel and close one when you are satisfied with the results of the job.

  • query_delay (Literal[-1] | ~typing.Literal[0] | str | None) – The number of seconds behind real time that data is queried. For example, if data from 10:04 a.m. might not be searchable in Elasticsearch until 10:06 a.m., set this property to 120 seconds. The default value is randomly selected between 60s and 120s. This randomness improves the query performance when there are multiple jobs running on the same node.

  • runtime_mappings (Mapping[str, Mapping[str, Any]] | None) – Specifies runtime fields for the datafeed search.

  • script_fields (Mapping[str, Mapping[str, Any]] | None) – Specifies scripts that evaluate custom expressions and returns script fields to the datafeed. The detector configuration objects in a job can contain functions that use these script fields.

  • scroll_size (int | None) – The size parameter that is used in Elasticsearch searches when the datafeed does not use aggregations. The maximum value is the value of index.max_result_window.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_filter(*, filter_id, add_items=None, description=None, error_trace=None, filter_path=None, human=None, pretty=None, remove_items=None)

Updates the description of a filter, adds items, or removes items.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-update-filter.html

Parameters:
  • filter_id (str) – A string that uniquely identifies a filter.

  • add_items (Sequence[str] | None) – The items to add to the filter.

  • description (str | None) – A description for the filter.

  • remove_items (Sequence[str] | None) – The items to remove from the filter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_job(*, job_id, allow_lazy_open=None, analysis_limits=None, background_persist_interval=None, categorization_filters=None, custom_settings=None, daily_model_snapshot_retention_after_days=None, description=None, detectors=None, error_trace=None, filter_path=None, groups=None, human=None, model_plot_config=None, model_prune_window=None, model_snapshot_retention_days=None, per_partition_categorization=None, pretty=None, renormalization_window_days=None, results_retention_days=None)

Updates certain properties of an anomaly detection job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-update-job.html

Parameters:
  • job_id (str) – Identifier for the job.

  • allow_lazy_open (bool | None) – Advanced configuration option. Specifies whether this job can open when there is insufficient machine learning node capacity for it to be immediately assigned to a node. If false and a machine learning node with capacity to run the job cannot immediately be found, the open anomaly detection jobs API returns an error. However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting. If this option is set to true, the open anomaly detection jobs API does not return an error and the job waits in the opening state until sufficient machine learning node capacity is available.

  • analysis_limits (Mapping[str, Any] | None) –

  • background_persist_interval (Literal[-1] | ~typing.Literal[0] | str | None) – Advanced configuration option. The time between each periodic persistence of the model. The default value is a randomized value between 3 to 4 hours, which avoids all jobs persisting at exactly the same time. The smallest allowed value is 1 hour. For very large models (several GB), persistence could take 10-20 minutes, so do not set the value too low. If the job is open when you make the update, you must stop the datafeed, close the job, then reopen the job and restart the datafeed for the changes to take effect.

  • categorization_filters (Sequence[str] | None) –

  • custom_settings (Mapping[str, Any] | None) – Advanced configuration option. Contains custom meta data about the job. For example, it can contain custom URL information as shown in Adding custom URLs to machine learning results.

  • daily_model_snapshot_retention_after_days (int | None) – Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies a period of time (in days) after which only the first snapshot per day is retained. This period is relative to the timestamp of the most recent snapshot for this job. Valid values range from 0 to model_snapshot_retention_days. For jobs created before version 7.8.0, the default value matches model_snapshot_retention_days.

  • description (str | None) – A description of the job.

  • detectors (Sequence[Mapping[str, Any]] | None) – An array of detector update objects.

  • groups (Sequence[str] | None) – A list of job groups. A job can belong to no groups or many.

  • model_plot_config (Mapping[str, Any] | None) –

  • model_prune_window (Literal[-1] | ~typing.Literal[0] | str | None) –

  • model_snapshot_retention_days (int | None) – Advanced configuration option, which affects the automatic removal of old model snapshots for this job. It specifies the maximum period of time (in days) that snapshots are retained. This period is relative to the timestamp of the most recent snapshot for this job.

  • per_partition_categorization (Mapping[str, Any] | None) – Settings related to how categorization interacts with partition fields.

  • renormalization_window_days (int | None) – Advanced configuration option. The period over which adjustments to the score are applied, as new data is seen.

  • results_retention_days (int | None) – Advanced configuration option. The period of time (in days) that results are retained. Age is calculated relative to the timestamp of the latest bucket result. If this property has a non-null value, once per day at 00:30 (server time), results that are the specified number of days older than the latest bucket result are deleted from Elasticsearch. The default value is null, which means all results are retained.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_model_snapshot(*, job_id, snapshot_id, description=None, error_trace=None, filter_path=None, human=None, pretty=None, retain=None)

Updates certain properties of a snapshot.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-update-snapshot.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • snapshot_id (str) – Identifier for the model snapshot.

  • description (str | None) – A description of the model snapshot.

  • retain (bool | None) – If true, this snapshot will not be deleted during automatic cleanup of snapshots older than model_snapshot_retention_days. However, this snapshot will be deleted when the job is deleted.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

upgrade_job_snapshot(*, job_id, snapshot_id, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None, wait_for_completion=None)

Upgrades a given job snapshot to the current major version.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/ml-upgrade-job-model-snapshot.html

Parameters:
  • job_id (str) – Identifier for the anomaly detection job.

  • snapshot_id (str) – A numerical character string that uniquely identifies the model snapshot.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Controls the time to wait for the request to complete.

  • wait_for_completion (bool | None) – When true, the API won’t respond until the upgrade is complete. Otherwise, it responds as soon as the upgrade task is assigned to a node.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

validate(*, analysis_config=None, analysis_limits=None, data_description=None, description=None, error_trace=None, filter_path=None, human=None, job_id=None, model_plot=None, model_snapshot_id=None, model_snapshot_retention_days=None, pretty=None, results_index_name=None)

Validates an anomaly detection job.

https://www.elastic.co/guide/en/machine-learning/8.10/ml-jobs.html

Parameters:
  • analysis_config (Mapping[str, Any] | None) –

  • analysis_limits (Mapping[str, Any] | None) –

  • data_description (Mapping[str, Any] | None) –

  • description (str | None) –

  • job_id (str | None) –

  • model_plot (Mapping[str, Any] | None) –

  • model_snapshot_id (str | None) –

  • model_snapshot_retention_days (int | None) –

  • results_index_name (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

validate_detector(*, detector, error_trace=None, filter_path=None, human=None, pretty=None)

Validates an anomaly detection detector.

https://www.elastic.co/guide/en/machine-learning/8.10/ml-jobs.html

Parameters:
Return type:

ObjectApiResponse[Any]

Monitoring

class elasticsearch.client.MonitoringClient(client)
Parameters:

client (BaseClient) –

bulk(*, interval, operations, system_api_version, system_id, error_trace=None, filter_path=None, human=None, pretty=None)

Used by the monitoring features to send monitoring data.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/monitor-elasticsearch-cluster.html

Parameters:
  • interval (Literal[-1] | ~typing.Literal[0] | str) – Collection interval (e.g., ’10s’ or ‘10000ms’) of the payload

  • operations (Sequence[Mapping[str, Any]]) –

  • system_api_version (str) –

  • system_id (str) – Identifier of the monitored system

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Nodes

class elasticsearch.client.NodesClient(client)
Parameters:

client (BaseClient) –

clear_repositories_metering_archive(*, node_id, max_archive_version, error_trace=None, filter_path=None, human=None, pretty=None)

Removes the archived repositories metering information present in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/clear-repositories-metering-archive-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

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

Returns cluster repositories metering information.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-repositories-metering-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

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

Returns information about hot threads on each node in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-nodes-hot-threads.html

Parameters:
  • node_id (str | Sequence[str] | None) – List of node IDs or names used to limit returned information.

  • ignore_idle_threads (bool | None) – If true, known idle threads (e.g. waiting in a socket select, or to get a task from an empty queue) are filtered out.

  • interval (Literal[-1] | ~typing.Literal[0] | str | None) – The interval to do the second sampling of threads.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • snapshots (int | None) – Number of samples of thread stacktrace.

  • sort (Literal['block', 'cpu', 'gpu', 'mem', 'wait'] | str | None) – The sort order for ‘cpu’ type (default: total)

  • threads (int | None) – Specifies the number of hot threads to provide information for.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • type (Literal['block', 'cpu', 'gpu', 'mem', 'wait'] | str | None) – The type to sample.

  • 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, master_timeout=None, pretty=None, timeout=None)

Returns information about nodes in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-nodes-info.html

Parameters:
  • node_id (str | Sequence[str] | None) – Comma-separated list of node IDs or names used to limit returned information.

  • metric (str | Sequence[str] | None) – Limits the information returned to the specific metrics. Supports a comma-separated list, such as http,ingest.

  • flat_settings (bool | None) – If true, returns settings in flat format.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

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

Reloads secure settings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/secure-settings.html#reloadable-secure-settings

Parameters:
  • node_id (str | Sequence[str] | None) – A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes.

  • secure_settings_password (str | None) –

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | 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, master_timeout=None, pretty=None, timeout=None, types=None)

Returns statistical information about nodes in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-nodes-stats.html

Parameters:
  • node_id (str | Sequence[str] | None) – Comma-separated list of node IDs or names used to limit returned information.

  • metric (str | Sequence[str] | None) – Limit the information returned to the specified metrics

  • index_metric (str | Sequence[str] | None) – Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified.

  • completion_fields (str | Sequence[str] | None) – Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.

  • fielddata_fields (str | Sequence[str] | None) – Comma-separated list or wildcard expressions of fields to include in fielddata statistics.

  • fields (str | Sequence[str] | None) – Comma-separated list or wildcard expressions of fields to include in the statistics.

  • groups (bool | None) – Comma-separated list of search groups to include in the search statistics.

  • include_segment_file_sizes (bool | None) – If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested).

  • include_unloaded_segments (bool | None) – If set to true segment stats will include stats for segments that are not currently loaded into memory

  • level (Literal['cluster', 'indices', 'shards'] | str | None) – Indicates whether statistics are aggregated at the cluster, index, or shard level.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • types (Sequence[str] | None) – A comma-separated list of document types for the indexing index metric.

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

Returns low-level information about REST actions usage on nodes.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/cluster-nodes-usage.html

Parameters:
  • node_id (str | Sequence[str] | None) – A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

  • metric (str | Sequence[str] | None) – Limit the information returned to the specified metrics

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Query rules

class elasticsearch.client.QueryRulesetClient(client)
Parameters:

client (BaseClient) –

delete(*, ruleset_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a query ruleset.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-query-ruleset.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset to delete

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get(*, ruleset_id, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the details about a query ruleset.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-query-ruleset.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

list(*, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None)

Lists query rulesets.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/list-query-rulesets.html

Parameters:
  • from – Starting offset (default: 0)

  • size (int | None) – specifies a max number of results to get

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put(*, ruleset_id, rules, error_trace=None, filter_path=None, human=None, pretty=None)

Creates or updates a query ruleset.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-query-ruleset.html

Parameters:
  • ruleset_id (str) – The unique identifier of the query ruleset to be created or updated

  • rules (Sequence[Mapping[str, Any]]) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Rollup Indices

class elasticsearch.client.RollupClient(client)
Parameters:

client (BaseClient) –

delete_job(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes an existing rollup job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/rollup-delete-job.html

Parameters:
  • id (str) – The ID of the job to delete

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_jobs(*, id=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves the configuration, stats, and status of rollup jobs.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/rollup-get-job.html

Parameters:
  • id (str | None) – The ID of the job(s) to fetch. Accepts glob patterns, or left blank for all jobs

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_rollup_caps(*, id=None, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the capabilities of any rollup jobs that have been configured for a specific index or index pattern.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/rollup-get-rollup-caps.html

Parameters:
  • id (str | None) – The ID of the index to check rollup capabilities on, or left blank for all jobs

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_rollup_index_caps(*, index, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the index where rollup data is stored).

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/rollup-get-rollup-index-caps.html

Parameters:
  • index (str | Sequence[str]) – The rollup index or index pattern to obtain rollup capabilities from.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_job(*, id, cron, groups, index_pattern, page_size, rollup_index, error_trace=None, filter_path=None, headers=None, human=None, metrics=None, pretty=None, timeout=None)

Creates a rollup job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/rollup-put-job.html

Parameters:
  • id (str) – Identifier for the rollup job. This can be any alphanumeric string and uniquely identifies the data that is associated with the rollup job. The ID is persistent; it is stored with the rolled up data. If you create a job, let it run for a while, then delete the job, the data that the job rolled up is still be associated with this job ID. You cannot create a new job with the same ID since that could lead to problems with mismatched job configurations.

  • cron (str) – A cron string which defines the intervals when the rollup job should be executed. When the interval triggers, the indexer attempts to rollup the data in the index pattern. The cron pattern is unrelated to the time interval of the data being rolled up. For example, you may wish to create hourly rollups of your document but to only run the indexer on a daily basis at midnight, as defined by the cron. The cron pattern is defined just like a Watcher cron schedule.

  • groups (Mapping[str, Any]) – Defines the grouping fields and aggregations that are defined for this rollup job. These fields will then be available later for aggregating into buckets. These aggs and fields can be used in any combination. Think of the groups configuration as defining a set of tools that can later be used in aggregations to partition the data. Unlike raw data, we have to think ahead to which fields and aggregations might be used. Rollups provide enough flexibility that you simply need to determine which fields are needed, not in what order they are needed.

  • index_pattern (str) – The index or index pattern to roll up. Supports wildcard-style patterns (logstash-*). The job attempts to rollup the entire index or index-pattern.

  • page_size (int) – The number of bucket results that are processed on each iteration of the rollup indexer. A larger value tends to execute faster, but requires more memory during processing. This value has no effect on how the data is rolled up; it is merely used for tweaking the speed or memory cost of the indexer.

  • rollup_index (str) – The index that contains the rollup results. The index can be shared with other rollup jobs. The data is stored so that it doesn’t interfere with unrelated jobs.

  • headers (Mapping[str, str | Sequence[str]] | None) –

  • metrics (Sequence[Mapping[str, Any]] | None) – Defines the metrics to collect for each grouping tuple. By default, only the doc_counts are collected for each group. To make rollup useful, you will often add metrics like averages, mins, maxes, etc. Metrics are defined on a per-field basis and for each field you configure which metric should be collected.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Time to wait for the request to complete.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Enables searching rolled-up data using the standard query DSL.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/rollup-search.html

Parameters:
  • index (str | Sequence[str]) – The indices or index-pattern(s) (containing rollup or regular data) that should be searched

  • aggregations (Mapping[str, Mapping[str, Any]] | None) –

  • aggs (Mapping[str, Mapping[str, Any]] | None) –

  • query (Mapping[str, Any] | None) –

  • rest_total_hits_as_int (bool | None) – Indicates whether hits.total should be rendered as an integer or an object in the rest search response

  • size (int | None) – Must be zero if set, as rollups work on pre-aggregated data

  • typed_keys (bool | None) – Specify whether aggregation and suggester names should be prefixed by their respective types in the response

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

start_job(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Starts an existing, stopped rollup job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/rollup-start-job.html

Parameters:
  • id (str) – The ID of the job to start

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stop_job(*, id, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None, wait_for_completion=None)

Stops an existing, started rollup job.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/rollup-stop-job.html

Parameters:
  • id (str) – The ID of the job to stop

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Block for (at maximum) the specified duration while waiting for the job to stop. Defaults to 30s.

  • wait_for_completion (bool | None) – True if the API should block until the job has fully stopped, false if should be executed async. Defaults to false.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Search Applications

class elasticsearch.client.SearchApplicationClient(client)
Parameters:

client (BaseClient) –

delete(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a search application.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-search-application.html

Parameters:
  • name (str) – The name of the search application to delete

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_behavioral_analytics(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Delete a behavioral analytics collection.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-analytics-collection.html

Parameters:
  • name (str) – The name of the analytics collection to be deleted

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the details about a search application.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-search-application.html

Parameters:
  • name (str) – The name of the search application

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_behavioral_analytics(*, name=None, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the existing behavioral analytics collections.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/list-analytics-collection.html

Parameters:
  • name (Sequence[str] | None) – A list of analytics collections to limit the returned information

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

list(*, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, q=None, size=None)

Returns the existing search applications.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/list-search-applications.html

Parameters:
  • from – Starting offset (default: 0)

  • q (str | None) – Query in the Lucene query string syntax”

  • size (int | None) – specifies a max number of results to get

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put(*, name, search_application, create=None, error_trace=None, filter_path=None, human=None, pretty=None)

Creates or updates a search application.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-search-application.html

Parameters:
  • name (str) – The name of the search application to be created or updated

  • search_application (Mapping[str, Any]) –

  • create (bool | None) – If true, requires that a search application with the specified resource_id does not already exist. (default: false)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_behavioral_analytics(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Creates a behavioral analytics collection.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-analytics-collection.html

Parameters:
  • name (str) – The name of the analytics collection to be created or updated

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

search(*, name, error_trace=None, filter_path=None, human=None, params=None, pretty=None)

Perform a search against a search application

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/search-application-search.html

Parameters:
  • name (str) – The name of the search application to be searched

  • params (Mapping[str, Any] | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Searchable Snapshots

class elasticsearch.client.SearchableSnapshotsClient(client)
Parameters:

client (BaseClient) –

cache_stats(*, node_id=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)

Retrieve node-level cache statistics about searchable snapshots.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/searchable-snapshots-apis.html

Parameters:
  • node_id (str | Sequence[str] | None) – A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clear_cache(*, index=None, allow_no_indices=None, error_trace=None, expand_wildcards=None, filter_path=None, human=None, ignore_unavailable=None, pretty=None)

Clear the cache of searchable snapshots.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/searchable-snapshots-apis.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of index names

  • allow_no_indices (bool | None) – Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes _all string or when no indices have been specified)

  • expand_wildcards (Sequence[Literal['all', 'closed', 'hidden', 'none', 'open'] | str] | ~typing.Literal['all', 'closed', 'hidden', 'none', 'open'] | str | None) – Whether to expand wildcard expression to concrete indices that are open, closed or both.

  • ignore_unavailable (bool | None) – Whether specified concrete indices should be ignored when unavailable (missing or closed)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

mount(*, repository, snapshot, index, error_trace=None, filter_path=None, human=None, ignore_index_settings=None, index_settings=None, master_timeout=None, pretty=None, renamed_index=None, storage=None, wait_for_completion=None)

Mount a snapshot as a searchable index.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/searchable-snapshots-api-mount-snapshot.html

Parameters:
  • repository (str) – The name of the repository containing the snapshot of the index to mount

  • snapshot (str) – The name of the snapshot of the index to mount

  • index (str) –

  • ignore_index_settings (Sequence[str] | None) –

  • index_settings (Mapping[str, Any] | None) –

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • renamed_index (str | None) –

  • storage (str | None) – Selects the kind of local storage used to accelerate searches. Experimental, and defaults to full_copy

  • wait_for_completion (bool | None) – Should this request wait until the operation has completed before returning

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stats(*, index=None, error_trace=None, filter_path=None, human=None, level=None, pretty=None)

Retrieve shard-level statistics about searchable snapshots.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/searchable-snapshots-apis.html

Parameters:
  • index (str | Sequence[str] | None) – A comma-separated list of index names

  • level (Literal['cluster', 'indices', 'shards'] | str | None) – Return stats aggregated at cluster, index or shard level

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Security

class elasticsearch.client.SecurityClient(client)
Parameters:

client (BaseClient) –

activate_user_profile(*, grant_type, access_token=None, error_trace=None, filter_path=None, human=None, password=None, pretty=None, username=None)

Creates or updates the user profile on behalf of another user.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-activate-user-profile.html

Parameters:
  • grant_type (Literal['access_token', 'password'] | str) –

  • access_token (str | None) –

  • password (str | None) –

  • username (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

authenticate(*, error_trace=None, filter_path=None, human=None, pretty=None)

Enables authentication as a user and retrieve information about the authenticated user.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-authenticate.html

Parameters:
Return type:

ObjectApiResponse[Any]

change_password(*, username=None, error_trace=None, filter_path=None, human=None, password=None, password_hash=None, pretty=None, refresh=None)

Changes the passwords of users in the native realm and built-in users.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-change-password.html

Parameters:
  • username (str | None) – The user whose password you want to change. If you do not specify this parameter, the password is changed for the current user.

  • password (str | None) – The new password value. Passwords must be at least 6 characters long.

  • password_hash (str | None) – A hash of the new password value. This must be produced using the same hashing algorithm as has been configured for password storage. For more details, see the explanation of the xpack.security.authc.password_hashing.algorithm setting.

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clear_api_key_cache(*, ids, error_trace=None, filter_path=None, human=None, pretty=None)

Clear a subset or all entries from the API key cache.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-clear-api-key-cache.html

Parameters:
  • ids (str | Sequence[str]) – Comma-separated list of API key IDs to evict from the API key cache. To evict all API keys, use *. Does not support other wildcard patterns.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clear_cached_privileges(*, application, error_trace=None, filter_path=None, human=None, pretty=None)

Evicts application privileges from the native application privileges cache.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-clear-privilege-cache.html

Parameters:
  • application (str) – A comma-separated list of application names

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clear_cached_realms(*, realms, error_trace=None, filter_path=None, human=None, pretty=None, usernames=None)

Evicts users from the user cache. Can completely clear the cache or evict specific users.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-clear-cache.html

Parameters:
  • realms (str | Sequence[str]) – Comma-separated list of realms to clear

  • usernames (Sequence[str] | None) – Comma-separated list of usernames to clear from the cache

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clear_cached_roles(*, name, error_trace=None, filter_path=None, human=None, pretty=None)

Evicts roles from the native role cache.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-clear-role-cache.html

Parameters:
Return type:

ObjectApiResponse[Any]

clear_cached_service_tokens(*, namespace, service, name, error_trace=None, filter_path=None, human=None, pretty=None)

Evicts tokens from the service account token caches.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-clear-service-token-caches.html

Parameters:
  • namespace (str) – An identifier for the namespace

  • service (str) – An identifier for the service name

  • name (str | Sequence[str]) – A comma-separated list of service token names

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

create_api_key(*, error_trace=None, expiration=None, filter_path=None, human=None, metadata=None, name=None, pretty=None, refresh=None, role_descriptors=None)

Creates an API key for access without requiring basic authentication.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-create-api-key.html

Parameters:
  • expiration (Literal[-1] | ~typing.Literal[0] | str | None) – Expiration time for the API key. By default, API keys never expire.

  • metadata (Mapping[str, Any] | None) – Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage.

  • name (str | None) – Specifies the name for this API key.

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • role_descriptors (Mapping[str, Mapping[str, Any]] | None) – An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

create_service_token(*, namespace, service, name=None, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Creates a service account token for access without requiring basic authentication.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-create-service-token.html

Parameters:
  • namespace (str) – An identifier for the namespace

  • service (str) – An identifier for the service name

  • name (str | None) – An identifier for the token name

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_privileges(*, application, name, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Removes application privileges.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-delete-privilege.html

Parameters:
  • application (str) – Application name

  • name (str | Sequence[str]) – Privilege name

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_role(*, name, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Removes roles in the native realm.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-delete-role.html

Parameters:
  • name (str) – Role name

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_role_mapping(*, name, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Removes role mappings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-delete-role-mapping.html

Parameters:
  • name (str) – Role-mapping name

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_service_token(*, namespace, service, name, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Deletes a service account token.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-delete-service-token.html

Parameters:
  • namespace (str) – An identifier for the namespace

  • service (str) – An identifier for the service name

  • name (str) – An identifier for the token name

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true then refresh the affected shards to make this operation visible to search, if wait_for (the default) then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_user(*, username, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Deletes users from the native realm.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-delete-user.html

Parameters:
  • username (str) – username

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

disable_user(*, username, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Disables users in the native realm.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-disable-user.html

Parameters:
  • username (str) – The username of the user to disable

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

disable_user_profile(*, uid, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Disables a user profile so it’s not visible in user profile searches.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-disable-user-profile.html

Parameters:
  • uid (str) – Unique identifier for the user profile.

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If ‘true’, Elasticsearch refreshes the affected shards to make this operation visible to search, if ‘wait_for’ then wait for a refresh to make this operation visible to search, if ‘false’ do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

enable_user(*, username, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Enables users in the native realm.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-enable-user.html

Parameters:
  • username (str) – The username of the user to enable

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

enable_user_profile(*, uid, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Enables a user profile so it’s visible in user profile searches.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-enable-user-profile.html

Parameters:
  • uid (str) – Unique identifier for the user profile.

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If ‘true’, Elasticsearch refreshes the affected shards to make this operation visible to search, if ‘wait_for’ then wait for a refresh to make this operation visible to search, if ‘false’ do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

enroll_kibana(*, error_trace=None, filter_path=None, human=None, pretty=None)

Allows a kibana instance to configure itself to communicate with a secured elasticsearch cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-kibana-enrollment.html

Parameters:
Return type:

ObjectApiResponse[Any]

enroll_node(*, error_trace=None, filter_path=None, human=None, pretty=None)

Allows a new node to enroll to an existing cluster with security enabled.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-node-enrollment.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_api_key(*, error_trace=None, filter_path=None, human=None, id=None, name=None, owner=None, pretty=None, realm_name=None, username=None, with_limited_by=None)

Retrieves information for one or more API keys.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-api-key.html

Parameters:
  • id (str | None) – An API key id. This parameter cannot be used with any of name, realm_name or username.

  • name (str | None) – An API key name. This parameter cannot be used with any of id, realm_name or username. It supports prefix search with wildcard.

  • owner (bool | None) – A boolean flag that can be used to query API keys owned by the currently authenticated user. The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones.

  • realm_name (str | None) – The name of an authentication realm. This parameter cannot be used with either id or name or when owner flag is set to true.

  • username (str | None) – The username of a user. This parameter cannot be used with either id or name or when owner flag is set to true.

  • with_limited_by (bool | None) – Return the snapshot of the owner user’s role descriptors associated with the API key. An API key’s actual permission is the intersection of its assigned role descriptors and the owner user’s role descriptors.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_builtin_privileges(*, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves the list of cluster privileges and index privileges that are available in this version of Elasticsearch.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-builtin-privileges.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_privileges(*, application=None, name=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves application privileges.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-privileges.html

Parameters:
  • application (str | None) – Application name

  • name (str | Sequence[str] | None) – Privilege name

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_role(*, name=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves roles in the native realm.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-role.html

Parameters:
  • name (str | Sequence[str] | None) – The name of the role. You can specify multiple roles as a comma-separated list. If you do not specify this parameter, the API returns information about all roles.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_role_mapping(*, name=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves role mappings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-role-mapping.html

Parameters:
  • name (str | Sequence[str] | None) – The distinct name that identifies the role mapping. The name is used solely as an identifier to facilitate interaction via the API; it does not affect the behavior of the mapping in any way. You can specify multiple mapping names as a comma-separated list. If you do not specify this parameter, the API returns information about all role mappings.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_service_accounts(*, namespace=None, service=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information about service accounts.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-service-accounts.html

Parameters:
  • namespace (str | None) – Name of the namespace. Omit this parameter to retrieve information about all service accounts. If you omit this parameter, you must also omit the service parameter.

  • service (str | None) – Name of the service name. Omit this parameter to retrieve information about all service accounts that belong to the specified namespace.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_service_credentials(*, namespace, service, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information of all service credentials for a service account.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-service-credentials.html

Parameters:
  • namespace (str) – Name of the namespace.

  • service (str) – Name of the service name.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_token(*, error_trace=None, filter_path=None, grant_type=None, human=None, kerberos_ticket=None, password=None, pretty=None, refresh_token=None, scope=None, username=None)

Creates a bearer token for access without requiring basic authentication.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-token.html

Parameters:
  • grant_type (Literal['_kerberos', 'client_credentials', 'password', 'refresh_token'] | str | None) –

  • kerberos_ticket (str | None) –

  • password (str | None) –

  • refresh_token (str | None) –

  • scope (str | None) –

  • username (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_user(*, username=None, error_trace=None, filter_path=None, human=None, pretty=None, with_profile_uid=None)

Retrieves information about users in the native realm and built-in users.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-user.html

Parameters:
  • username (str | Sequence[str] | None) – An identifier for the user. You can specify multiple usernames as a comma-separated list. If you omit this parameter, the API retrieves information about all users.

  • with_profile_uid (bool | None) – If true will return the User Profile ID for a user, if any.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_user_privileges(*, application=None, error_trace=None, filter_path=None, human=None, pretty=None, priviledge=None, username=None)

Retrieves security privileges for the logged in user.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-user-privileges.html

Parameters:
  • application (str | None) – The name of the application. Application privileges are always associated with exactly one application. If you do not specify this parameter, the API returns information about all privileges for all applications.

  • priviledge (str | None) – The name of the privilege. If you do not specify this parameter, the API returns information about all privileges for the requested application.

  • username (None | str) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_user_profile(*, uid, data=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves user profiles for the given unique ID(s).

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-get-user-profile.html

Parameters:
  • uid (str | Sequence[str]) – A unique identifier for the user profile.

  • data (str | Sequence[str] | None) – List of filters for the data field of the profile document. To return all content use data=*. To return a subset of content use data=<key> to retrieve content nested under the specified <key>. By default returns no data content.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

grant_api_key(*, api_key, grant_type, access_token=None, error_trace=None, filter_path=None, human=None, password=None, pretty=None, run_as=None, username=None)

Creates an API key on behalf of another user.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-grant-api-key.html

Parameters:
  • api_key (Mapping[str, Any]) – Defines the API key.

  • grant_type (Literal['access_token', 'password'] | str) – The type of grant. Supported grant types are: access_token, password.

  • access_token (str | None) – The user’s access token. If you specify the access_token grant type, this parameter is required. It is not valid with other grant types.

  • password (str | None) – The user’s password. If you specify the password grant type, this parameter is required. It is not valid with other grant types.

  • run_as (str | None) – The name of the user to be impersonated.

  • username (str | None) – The user name that identifies the user. If you specify the password grant type, this parameter is required. It is not valid with other grant types.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

has_privileges(*, user=None, application=None, cluster=None, error_trace=None, filter_path=None, human=None, index=None, pretty=None)

Determines whether the specified user has a specified list of privileges.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-has-privileges.html

Parameters:
  • user (str | None) – Username

  • application (Sequence[Mapping[str, Any]] | None) –

  • cluster (Sequence[Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client'] | str] | None) – A list of the cluster privileges that you want to check.

  • index (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]

has_privileges_user_profile(*, privileges, uids, error_trace=None, filter_path=None, human=None, pretty=None)

Determines whether the users associated with the specified profile IDs have all the requested privileges.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-has-privileges-user-profile.html

Parameters:
  • privileges (Mapping[str, Any]) –

  • uids (Sequence[str]) – A list of profile IDs. The privileges are checked for associated users of the profiles.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

invalidate_api_key(*, error_trace=None, filter_path=None, human=None, id=None, ids=None, name=None, owner=None, pretty=None, realm_name=None, username=None)

Invalidates one or more API keys.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-invalidate-api-key.html

Parameters:
  • id (str | None) –

  • ids (Sequence[str] | None) – A list of API key ids. This parameter cannot be used with any of name, realm_name, or username.

  • name (str | None) – An API key name. This parameter cannot be used with any of ids, realm_name or username.

  • owner (bool | None) – Can be used to query API keys owned by the currently authenticated user. The realm_name or username parameters cannot be specified when this parameter is set to true as they are assumed to be the currently authenticated ones.

  • realm_name (str | None) – The name of an authentication realm. This parameter cannot be used with either ids or name, or when owner flag is set to true.

  • username (str | None) – The username of a user. This parameter cannot be used with either ids or name, or when owner flag is set to true.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

invalidate_token(*, error_trace=None, filter_path=None, human=None, pretty=None, realm_name=None, refresh_token=None, token=None, username=None)

Invalidates one or more access tokens or refresh tokens.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-invalidate-token.html

Parameters:
  • realm_name (str | None) –

  • refresh_token (str | None) –

  • token (str | None) –

  • username (str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_privileges(*, privileges, error_trace=None, filter_path=None, human=None, pretty=None, refresh=None)

Adds or updates application privileges.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-put-privileges.html

Parameters:
  • privileges (Mapping[str, Mapping[str, Mapping[str, Any]]]) –

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_role(*, name, applications=None, cluster=None, error_trace=None, filter_path=None, global_=None, human=None, indices=None, metadata=None, pretty=None, refresh=None, run_as=None, transient_metadata=None)

Adds and updates roles in the native realm.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-put-role.html

Parameters:
  • name (str) – The name of the role.

  • applications (Sequence[Mapping[str, Any]] | None) – A list of application privilege entries.

  • cluster (Sequence[Literal['all', 'cancel_task', 'create_snapshot', 'grant_api_key', 'manage', 'manage_api_key', 'manage_ccr', 'manage_enrich', 'manage_ilm', 'manage_index_templates', 'manage_ingest_pipelines', 'manage_logstash_pipelines', 'manage_ml', 'manage_oidc', 'manage_own_api_key', 'manage_pipeline', 'manage_rollup', 'manage_saml', 'manage_security', 'manage_service_account', 'manage_slm', 'manage_token', 'manage_transform', 'manage_user_profile', 'manage_watcher', 'monitor', 'monitor_ml', 'monitor_rollup', 'monitor_snapshot', 'monitor_text_structure', 'monitor_transform', 'monitor_watcher', 'read_ccr', 'read_ilm', 'read_pipeline', 'read_slm', 'transport_client'] | str] | None) – A list of cluster privileges. These privileges define the cluster-level actions for users with this role.

  • global – An object defining global privileges. A global privilege is a form of cluster privilege that is request-aware. Support for global privileges is currently limited to the management of application privileges.

  • indices (Sequence[Mapping[str, Any]] | None) – A list of indices permissions entries.

  • metadata (Mapping[str, Any] | None) – Optional metadata. Within the metadata object, keys that begin with an underscore (_) are reserved for system use.

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • run_as (Sequence[str] | None) – A list of users that the owners of this role can impersonate.

  • transient_metadata (Mapping[str, Any] | None) – Indicates roles that might be incompatible with the current cluster license, specifically roles with document and field level security. When the cluster license doesn’t allow certain features for a given role, this parameter is updated dynamically to list the incompatible features. If enabled is false, the role is ignored, but is still listed in the response from the authenticate API.

  • error_trace (bool | None) –

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

  • global_ (Mapping[str, Any] | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_role_mapping(*, name, enabled=None, error_trace=None, filter_path=None, human=None, metadata=None, pretty=None, refresh=None, roles=None, rules=None, run_as=None)

Creates and updates role mappings.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-put-role-mapping.html

Parameters:
  • name (str) – Role-mapping name

  • enabled (bool | None) –

  • metadata (Mapping[str, Any] | None) –

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • roles (Sequence[str] | None) –

  • rules (Mapping[str, Any] | None) –

  • run_as (Sequence[str] | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_user(*, username, email=None, enabled=None, error_trace=None, filter_path=None, full_name=None, human=None, metadata=None, password=None, password_hash=None, pretty=None, refresh=None, roles=None)

Adds and updates users in the native realm. These users are commonly referred to as native users.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-put-user.html

Parameters:
  • username (str) – The username of the User

  • email (None | str) –

  • enabled (bool | None) –

  • full_name (None | str) –

  • metadata (Mapping[str, Any] | None) –

  • password (str | None) –

  • password_hash (str | None) –

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If true (the default) then refresh the affected shards to make this operation visible to search, if wait_for then wait for a refresh to make this operation visible to search, if false then do nothing with refreshes.

  • roles (Sequence[str] | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

query_api_keys(*, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, query=None, search_after=None, size=None, sort=None, with_limited_by=None)

Retrieves information for API keys using a subset of query DSL

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-query-api-key.html

Parameters:
  • 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.

  • query (Mapping[str, Any] | None) – A query to filter which API keys to return. The query supports a subset of query types, including match_all, bool, term, terms, ids, prefix, wildcard, and range. You can query all public information associated with an API key.

  • search_after (Sequence[None | bool | float | int | str | Any] | None) – Search after definition

  • 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) – Other than id, all public fields of an API key are eligible for sorting. In addition, sort can also be applied to the _doc field to sort by index order.

  • with_limited_by (bool | None) – Return the snapshot of the owner user’s role descriptors associated with the API key. An API key’s actual permission is the intersection of its assigned role descriptors and the owner user’s role descriptors.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

saml_authenticate(*, content, ids, error_trace=None, filter_path=None, human=None, pretty=None, realm=None)

Exchanges a SAML Response message for an Elasticsearch access token and refresh token pair

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-saml-authenticate.html

Parameters:
  • content (str) – The SAML response as it was sent by the user’s browser, usually a Base64 encoded XML document.

  • ids (str | Sequence[str]) – A json array with all the valid SAML Request Ids that the caller of the API has for the current user.

  • realm (str | None) – The name of the realm that should authenticate the SAML response. Useful in cases where many SAML realms are defined.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

saml_complete_logout(*, ids, realm, content=None, error_trace=None, filter_path=None, human=None, pretty=None, query_string=None)

Verifies the logout response sent from the SAML IdP

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-saml-complete-logout.html

Parameters:
  • ids (str | Sequence[str]) – A json array with all the valid SAML Request Ids that the caller of the API has for the current user.

  • realm (str) – The name of the SAML realm in Elasticsearch for which the configuration is used to verify the logout response.

  • content (str | None) – If the SAML IdP sends the logout response with the HTTP-Post binding, this field must be set to the value of the SAMLResponse form parameter from the logout response.

  • query_string (str | None) – If the SAML IdP sends the logout response with the HTTP-Redirect binding, this field must be set to the query string of the redirect URI.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

saml_invalidate(*, query_string, acs=None, error_trace=None, filter_path=None, human=None, pretty=None, realm=None)

Consumes a SAML LogoutRequest

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-saml-invalidate.html

Parameters:
  • query_string (str) – The query part of the URL that the user was redirected to by the SAML IdP to initiate the Single Logout. This query should include a single parameter named SAMLRequest that contains a SAML logout request that is deflated and Base64 encoded. If the SAML IdP has signed the logout request, the URL should include two extra parameters named SigAlg and Signature that contain the algorithm used for the signature and the signature value itself. In order for Elasticsearch to be able to verify the IdP’s signature, the value of the query_string field must be an exact match to the string provided by the browser. The client application must not attempt to parse or process the string in any way.

  • acs (str | None) – The Assertion Consumer Service URL that matches the one of the SAML realm in Elasticsearch that should be used. You must specify either this parameter or the realm parameter.

  • realm (str | None) – The name of the SAML realm in Elasticsearch the configuration. You must specify either this parameter or the acs parameter.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

saml_logout(*, token, error_trace=None, filter_path=None, human=None, pretty=None, refresh_token=None)

Invalidates an access token and a refresh token that were generated via the SAML Authenticate API

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-saml-logout.html

Parameters:
  • token (str) – The access token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent token that was received after refreshing the original one by using a refresh_token.

  • refresh_token (str | None) – The refresh token that was returned as a response to calling the SAML authenticate API. Alternatively, the most recent refresh token that was received after refreshing the original access token.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

saml_prepare_authentication(*, acs=None, error_trace=None, filter_path=None, human=None, pretty=None, realm=None, relay_state=None)

Creates a SAML authentication request

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-saml-prepare-authentication.html

Parameters:
  • acs (str | None) – The Assertion Consumer Service URL that matches the one of the SAML realms in Elasticsearch. The realm is used to generate the authentication request. You must specify either this parameter or the realm parameter.

  • realm (str | None) – The name of the SAML realm in Elasticsearch for which the configuration is used to generate the authentication request. You must specify either this parameter or the acs parameter.

  • relay_state (str | None) – A string that will be included in the redirect URL that this API returns as the RelayState query parameter. If the Authentication Request is signed, this value is used as part of the signature computation.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

saml_service_provider_metadata(*, realm_name, error_trace=None, filter_path=None, human=None, pretty=None)

Generates SAML metadata for the Elastic stack SAML 2.0 Service Provider

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-saml-sp-metadata.html

Parameters:
  • realm_name (str) – The name of the SAML realm in Elasticsearch.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

suggest_user_profiles(*, data=None, error_trace=None, filter_path=None, hint=None, human=None, name=None, pretty=None, size=None)

Get suggestions for user profiles that match specified search criteria.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-suggest-user-profile.html

Parameters:
  • data (str | Sequence[str] | None) – List of filters for the data field of the profile document. To return all content use data=*. To return a subset of content use data=<key> to retrieve content nested under the specified <key>. By default returns no data content.

  • hint (Mapping[str, Any] | None) – Extra search criteria to improve relevance of the suggestion result. Profiles matching the spcified hint are ranked higher in the response. Profiles not matching the hint don’t exclude the profile from the response as long as the profile matches the name field query.

  • name (str | None) – Query string used to match name-related fields in user profile documents. Name-related fields are the user’s username, full_name, and email.

  • size (int | None) – Number of profiles to return.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_api_key(*, id, error_trace=None, filter_path=None, human=None, metadata=None, pretty=None, role_descriptors=None)

Updates attributes of an existing API key.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-update-api-key.html

Parameters:
  • id (str) – The ID of the API key to update.

  • metadata (Mapping[str, Any] | None) – Arbitrary metadata that you want to associate with the API key. It supports nested data structure. Within the metadata object, keys beginning with _ are reserved for system usage.

  • role_descriptors (Mapping[str, Mapping[str, Any]] | None) – An array of role descriptors for this API key. This parameter is optional. When it is not specified or is an empty array, then the API key will have a point in time snapshot of permissions of the authenticated user. If you supply role descriptors then the resultant permissions would be an intersection of API keys permissions and authenticated user’s permissions thereby limiting the access scope for API keys. The structure of role descriptor is the same as the request for create role API. For more details, see create or update roles API.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_user_profile_data(*, uid, data=None, error_trace=None, filter_path=None, human=None, if_primary_term=None, if_seq_no=None, labels=None, pretty=None, refresh=None)

Update application specific data for the user profile of the given unique ID.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-update-user-profile-data.html

Parameters:
  • uid (str) – A unique identifier for the user profile.

  • data (Mapping[str, Any] | None) – Non-searchable data that you want to associate with the user profile. This field supports a nested data structure.

  • if_primary_term (int | None) – Only perform the operation if the document has this primary term.

  • if_seq_no (int | None) – Only perform the operation if the document has this sequence number.

  • labels (Mapping[str, Any] | None) – Searchable data that you want to associate with the user profile. This field supports a nested data structure.

  • refresh (Literal['false', 'true', 'wait_for'] | bool | str | None) – If ‘true’, Elasticsearch refreshes the affected shards to make this operation visible to search, if ‘wait_for’ then wait for a refresh to make this operation visible to search, if ‘false’ do nothing with refreshes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Shutdown

class elasticsearch.client.ShutdownClient(client)
Parameters:

client (BaseClient) –

delete_node(*, node_id, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Removes a node from the shutdown list. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.

https://www.elastic.co/guide/en/elasticsearch/reference/current

Parameters:
  • node_id (str) – The node id of node to be removed from the shutdown state

  • master_timeout (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_node(*, node_id=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Retrieve status of a node or nodes that are currently marked as shutting down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.

https://www.elastic.co/guide/en/elasticsearch/reference/current

Parameters:
  • node_id (str | Sequence[str] | None) – Which node for which to retrieve the shutdown status

  • master_timeout (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • timeout (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_node(*, node_id, reason, type, allocation_delay=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, target_node_name=None, timeout=None)

Adds a node to be shut down. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported.

https://www.elastic.co/guide/en/elasticsearch/reference/current

Parameters:
  • node_id (str) – The node id of node to be shut down

  • reason (str) – A human-readable reason that the node is being shut down. This field provides information for other cluster operators; it does not affect the shut down process.

  • type (Literal['remove', 'replace', 'restart'] | str) – Valid values are restart, remove, or replace. Use restart when you need to temporarily shut down a node to perform an upgrade, make configuration changes, or perform other maintenance. Because the node is expected to rejoin the cluster, data is not migrated off of the node. Use remove when you need to permanently remove a node from the cluster. The node is not marked ready for shutdown until data is migrated off of the node Use replace to do a 1:1 replacement of a node with another node. Certain allocation decisions will be ignored (such as disk watermarks) in the interest of true replacement of the source node with the target node. During a replace-type shutdown, rollover and index creation may result in unassigned shards, and shrink may fail until the replacement is complete.

  • allocation_delay (str | None) – Only valid if type is restart. Controls how long Elasticsearch will wait for the node to restart and join the cluster before reassigning its shards to other nodes. This works the same as delaying allocation with the index.unassigned.node_left.delayed_timeout setting. If you specify both a restart allocation delay and an index-level allocation delay, the longer of the two is used.

  • master_timeout (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • target_node_name (str | None) – Only valid if type is replace. Specifies the name of the node that is replacing the node being shut down. Shards from the shut down node are only allowed to be allocated to the target node, and no other data will be allocated to the target node. During relocation of data certain allocation rules are ignored, such as disk watermarks or user attribute filtering rules.

  • timeout (Literal['d', 'h', 'm', 'micros', 'ms', 'nanos', 's'] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Snapshot Lifecycle Management (SLM)

class elasticsearch.client.SlmClient(client)
Parameters:

client (BaseClient) –

delete_lifecycle(*, policy_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes an existing snapshot lifecycle policy.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-delete-policy.html

Parameters:
  • policy_id (str) – The id of the snapshot lifecycle policy to remove

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

execute_lifecycle(*, policy_id, error_trace=None, filter_path=None, human=None, pretty=None)

Immediately creates a snapshot according to the lifecycle policy, without waiting for the scheduled time.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-execute-lifecycle.html

Parameters:
  • policy_id (str) – The id of the snapshot lifecycle policy to be executed

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

execute_retention(*, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes any snapshots that are expired according to the policy’s retention rules.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-execute-retention.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_lifecycle(*, policy_id=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves one or more snapshot lifecycle policy definitions and information about the latest snapshot attempts.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-get-policy.html

Parameters:
  • policy_id (str | Sequence[str] | None) – Comma-separated list of snapshot lifecycle policies to retrieve

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_stats(*, error_trace=None, filter_path=None, human=None, pretty=None)

Returns global and policy-level statistics about actions taken by snapshot lifecycle management.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-get-stats.html

Parameters:
Return type:

ObjectApiResponse[Any]

get_status(*, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves the status of snapshot lifecycle management (SLM).

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-get-status.html

Parameters:
Return type:

ObjectApiResponse[Any]

put_lifecycle(*, policy_id, config=None, error_trace=None, filter_path=None, human=None, master_timeout=None, name=None, pretty=None, repository=None, retention=None, schedule=None, timeout=None)

Creates or updates a snapshot lifecycle policy.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-put-policy.html

Parameters:
  • policy_id (str) – ID for the snapshot lifecycle policy you want to create or update.

  • config (Mapping[str, Any] | None) – Configuration for each snapshot created by the policy.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • name (str | None) – Name automatically assigned to each snapshot created by the policy. Date math is supported. To prevent conflicting snapshot names, a UUID is automatically appended to each snapshot name.

  • repository (str | None) – Repository used to store snapshots created by this policy. This repository must exist prior to the policy’s creation. You can create a repository using the snapshot repository API.

  • retention (Mapping[str, Any] | None) – Retention rules used to retain and delete snapshots created by the policy.

  • schedule (str | None) – Periodic or absolute schedule at which the policy creates snapshots. SLM applies schedule changes immediately.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

start(*, error_trace=None, filter_path=None, human=None, pretty=None)

Turns on snapshot lifecycle management (SLM).

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-start.html

Parameters:
Return type:

ObjectApiResponse[Any]

stop(*, error_trace=None, filter_path=None, human=None, pretty=None)

Turns off snapshot lifecycle management (SLM).

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/slm-api-stop.html

Parameters:
Return type:

ObjectApiResponse[Any]

Snapshots

class elasticsearch.client.SnapshotClient(client)
Parameters:

client (BaseClient) –

cleanup_repository(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Removes stale data from repository.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/clean-up-snapshot-repo-api.html

Parameters:
  • name (str) – Snapshot repository to clean up.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

clone(*, repository, snapshot, target_snapshot, indices, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Clones indices from one snapshot into another snapshot in the same repository.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • repository (str) – A repository name

  • snapshot (str) – The name of the snapshot to clone from

  • target_snapshot (str) – The name of the cloned snapshot to create

  • indices (str) –

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

create(*, repository, snapshot, error_trace=None, feature_states=None, filter_path=None, human=None, ignore_unavailable=None, include_global_state=None, indices=None, master_timeout=None, metadata=None, partial=None, pretty=None, wait_for_completion=None)

Creates a snapshot in a repository.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • repository (str) – Repository for the snapshot.

  • snapshot (str) – Name of the snapshot. Must be unique in the repository.

  • feature_states (Sequence[str] | None) – Feature states to include in the snapshot. Each feature state includes one or more system indices containing related data. You can view a list of eligible features using the get features API. If include_global_state is true, all current feature states are included by default. If include_global_state is false, no feature states are included by default.

  • ignore_unavailable (bool | None) – If true, the request ignores data streams and indices in indices that are missing or closed. If false, the request returns an error for any data stream or index that is missing or closed.

  • include_global_state (bool | None) – If true, the current cluster state is included in the snapshot. The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies. It also includes data stored in system indices, such as Watches and task records (configurable via feature_states).

  • indices (str | Sequence[str] | None) – Data streams and indices to include in the snapshot. Supports multi-target syntax. Includes all data streams and indices by default.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • metadata (Mapping[str, Any] | None) – Optional metadata for the snapshot. May have any contents. Must be less than 1024 bytes. This map is not automatically generated by Elasticsearch.

  • partial (bool | None) – If true, allows restoring a partial snapshot of indices with unavailable shards. Only shards that were successfully included in the snapshot will be restored. All missing shards will be recreated as empty. If false, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available.

  • wait_for_completion (bool | None) – If true, the request returns a response when the snapshot is complete. If false, the request returns a response when the snapshot initializes.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

create_repository(*, name, settings, type, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, repository=None, timeout=None, verify=None)

Creates a repository.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • name (str) – A repository name

  • settings (Mapping[str, Any]) –

  • type (str) –

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • repository (Mapping[str, Any] | None) –

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • verify (bool | None) – Whether to verify the repository after creation

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete(*, repository, snapshot, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)

Deletes one or more snapshots.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • repository (str) – A repository name

  • snapshot (str) – A comma-separated list of snapshot names

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_repository(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Deletes a repository.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • name (str | Sequence[str]) – Name of the snapshot repository to unregister. Wildcard (*) patterns are supported.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get(*, repository, snapshot, after=None, error_trace=None, filter_path=None, from_sort_value=None, human=None, ignore_unavailable=None, include_repository=None, index_details=None, index_names=None, master_timeout=None, offset=None, order=None, pretty=None, size=None, slm_policy_filter=None, sort=None, verbose=None)

Returns information about a snapshot.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • repository (str) – Comma-separated list of snapshot repository names used to limit the request. Wildcard (*) expressions are supported.

  • snapshot (str | Sequence[str]) – Comma-separated list of snapshot names to retrieve. Also accepts wildcards (*). - To get information about all snapshots in a registered repository, use a wildcard (*) or _all. - To get information about any snapshots that are currently running, use _current.

  • after (str | None) – Offset identifier to start pagination from as returned by the next field in the response body.

  • from_sort_value (str | None) – Value of the current sort column at which to start retrieval. Can either be a string snapshot- or repository name when sorting by snapshot or repository name, a millisecond time value or a number when sorting by index- or shard count.

  • ignore_unavailable (bool | None) – If false, the request returns an error for any snapshots that are unavailable.

  • include_repository (bool | None) – If true, returns the repository name in each snapshot.

  • index_details (bool | None) – If true, returns additional information about each index in the snapshot comprising the number of shards in the index, the total size of the index in bytes, and the maximum number of segments per shard in the index. Defaults to false, meaning that this information is omitted.

  • index_names (bool | None) – If true, returns the name of each index in each snapshot.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • offset (int | None) – Numeric offset to start pagination from based on the snapshots matching this request. Using a non-zero value for this parameter is mutually exclusive with using the after parameter. Defaults to 0.

  • order (Literal['asc', 'desc'] | str | None) – Sort order. Valid values are asc for ascending and desc for descending order. Defaults to asc, meaning ascending order.

  • size (int | None) – Maximum number of snapshots to return. Defaults to 0 which means return all that match the request without limit.

  • slm_policy_filter (str | None) – Filter snapshots by a comma-separated list of SLM policy names that snapshots belong to. Also accepts wildcards (*) and combinations of wildcards followed by exclude patterns starting with -. To include snapshots not created by an SLM policy you can use the special pattern _none that will match all snapshots without an SLM policy.

  • sort (Literal['duration', 'failed_shard_count', 'index_count', 'name', 'repository', 'shard_count', 'start_time'] | str | None) – Allows setting a sort order for the result. Defaults to start_time, i.e. sorting by snapshot start time stamp.

  • verbose (bool | None) – If true, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_repository(*, name=None, error_trace=None, filter_path=None, human=None, local=None, master_timeout=None, pretty=None)

Returns information about a repository.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • name (str | Sequence[str] | None) – A comma-separated list of repository names

  • local (bool | None) – Return local information, do not retrieve the state from master node (default: false)

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

restore(*, repository, snapshot, error_trace=None, feature_states=None, filter_path=None, human=None, ignore_index_settings=None, ignore_unavailable=None, include_aliases=None, include_global_state=None, index_settings=None, indices=None, master_timeout=None, partial=None, pretty=None, rename_pattern=None, rename_replacement=None, wait_for_completion=None)

Restores a snapshot.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • repository (str) – A repository name

  • snapshot (str) – A snapshot name

  • feature_states (Sequence[str] | None) –

  • ignore_index_settings (Sequence[str] | None) –

  • ignore_unavailable (bool | None) –

  • include_aliases (bool | None) –

  • include_global_state (bool | None) –

  • index_settings (Mapping[str, Any] | None) –

  • indices (str | Sequence[str] | None) –

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • partial (bool | None) –

  • rename_pattern (str | None) –

  • rename_replacement (str | None) –

  • wait_for_completion (bool | None) – Should this request wait until the operation has completed before returning

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

status(*, repository=None, snapshot=None, error_trace=None, filter_path=None, human=None, ignore_unavailable=None, master_timeout=None, pretty=None)

Returns information about the status of a snapshot.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • repository (str | None) – A repository name

  • snapshot (str | Sequence[str] | None) – A comma-separated list of snapshot names

  • ignore_unavailable (bool | None) – Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

verify_repository(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)

Verifies a repository.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/modules-snapshots.html

Parameters:
  • name (str) – A repository name

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout for connection to master node

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

SQL

class elasticsearch.client.SqlClient(client)
Parameters:

client (BaseClient) –

clear_cursor(*, cursor, error_trace=None, filter_path=None, human=None, pretty=None)

Clears the SQL cursor

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/clear-sql-cursor-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

delete_async(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes an async SQL search or a stored synchronous SQL search. If the search is still running, the API cancels it.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-async-sql-search-api.html

Parameters:
  • id (str) – The async search ID

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_async(*, id, delimiter=None, error_trace=None, filter_path=None, format=None, human=None, keep_alive=None, pretty=None, wait_for_completion_timeout=None)

Returns the current status and available results for an async SQL search or stored synchronous SQL search

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-async-sql-search-api.html

Parameters:
  • id (str) – The async search ID

  • delimiter (str | None) – Separator for CSV results. The API only supports this parameter for CSV responses.

  • format (str | None) – Format for the response. You must specify a format using this parameter or the Accept HTTP header. If you specify both, the API uses this parameter.

  • keep_alive (Literal[-1] | ~typing.Literal[0] | str | None) – Retention period for the search and its results. Defaults to the keep_alive period for the original SQL search.

  • wait_for_completion_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for complete results. Defaults to no timeout, meaning the request waits for complete search results.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_async_status(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Returns the current status of an async SQL search or a stored synchronous SQL search

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-async-sql-search-status-api.html

Parameters:
  • id (str) – The async search ID

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

query(*, catalog=None, columnar=None, cursor=None, error_trace=None, fetch_size=None, field_multi_value_leniency=None, filter=None, filter_path=None, format=None, human=None, index_using_frozen=None, keep_alive=None, keep_on_completion=None, page_timeout=None, params=None, pretty=None, query=None, request_timeout=None, runtime_mappings=None, time_zone=None, wait_for_completion_timeout=None)

Executes a SQL request

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/sql-search-api.html

Parameters:
  • catalog (str | None) – Default catalog (cluster) for queries. If unspecified, the queries execute on the data in the local cluster only.

  • columnar (bool | None) – If true, the results in a columnar fashion: one row represents all the values of a certain column from the current page of results.

  • cursor (str | None) –

  • fetch_size (int | None) – The maximum number of rows (or entries) to return in one response

  • field_multi_value_leniency (bool | None) – Throw an exception when encountering multiple values for a field (default) or be lenient and return the first value from the list (without any guarantees of what that will be - typically the first in natural ascending order).

  • filter (Mapping[str, Any] | None) – Optional Elasticsearch query DSL for additional filtering.

  • format (str | None) – a short version of the Accept header, e.g. json, yaml

  • index_using_frozen (bool | None) – If true, the search can run on frozen indices. Defaults to false.

  • keep_alive (Literal[-1] | ~typing.Literal[0] | str | None) – Retention period for an async or saved synchronous search.

  • keep_on_completion (bool | None) – If true, Elasticsearch stores synchronous searches if you also specify the wait_for_completion_timeout parameter. If false, Elasticsearch only stores async searches that don’t finish before the wait_for_completion_timeout.

  • page_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – The timeout before a pagination request fails.

  • params (Mapping[str, Any] | None) – Values for parameters in the query.

  • query (str | None) – SQL query to execute

  • request_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – The timeout before the request fails.

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

  • time_zone (str | None) – Time-zone in ISO 8601 used for executing the query on the server. More information available here.

  • wait_for_completion_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for complete results. Defaults to no timeout, meaning the request waits for complete search results. If the search doesn’t finish within this period, the search becomes async.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

translate(*, query, error_trace=None, fetch_size=None, filter=None, filter_path=None, human=None, pretty=None, time_zone=None)

Translates SQL into Elasticsearch queries

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/sql-translate-api.html

Parameters:
Return type:

ObjectApiResponse[Any]

Synonyms

class elasticsearch.client.SynonymsClient(client)
Parameters:

client (BaseClient) –

delete_synonym(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a synonym set

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-synonyms-set.html

Parameters:
  • id (str) – The id of the synonyms set to be deleted

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_synonym_rule(*, set_id, rule_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deletes a synonym rule in a synonym set

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-synonym-rule.html

Parameters:
  • set_id (str) – The id of the synonym set to be updated

  • rule_id (str) – The id of the synonym rule to be deleted

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_synonym(*, id, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None)

Retrieves a synonym set

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-synonyms-set.html

Parameters:
  • id (str) – “The id of the synonyms set to be retrieved

  • from – Starting offset for query rules to be retrieved

  • size (int | None) – specifies a max number of query rules to retrieve

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_synonym_rule(*, set_id, rule_id, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves a synonym rule from a synonym set

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-synonym-rule.html

Parameters:
  • set_id (str) – The id of the synonym set to retrieve the synonym rule from

  • rule_id (str) – The id of the synonym rule to retrieve

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_synonyms_sets(*, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None)

Retrieves a summary of all defined synonym sets

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/list-synonyms-sets.html

Parameters:
  • from – Starting offset

  • size (int | None) – specifies a max number of results to get

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_synonym(*, id, synonyms_set, error_trace=None, filter_path=None, human=None, pretty=None)

Creates or updates a synonyms set

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-synonyms-set.html

Parameters:
  • id (str) – The id of the synonyms set to be created or updated

  • synonyms_set (Sequence[Mapping[str, Any]]) – The synonym set information to update

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_synonym_rule(*, set_id, rule_id, synonyms, error_trace=None, filter_path=None, human=None, pretty=None)

Creates or updates a synonym rule in a synonym set

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-synonym-rule.html

Parameters:
  • set_id (str) – The id of the synonym set to be updated with the synonym rule

  • rule_id (str) – The id of the synonym rule to be updated or created

  • synonyms (Sequence[str]) –

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

TLS/SSL

class elasticsearch.client.SslClient(client)
Parameters:

client (BaseClient) –

certificates(*, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information about the X.509 certificates used to encrypt communications in the cluster.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/security-api-ssl.html

Parameters:
Return type:

ObjectApiResponse[Any]

Tasks

class elasticsearch.client.TasksClient(client)
Parameters:

client (BaseClient) –

cancel(*, task_id=None, actions=None, error_trace=None, filter_path=None, human=None, nodes=None, parent_task_id=None, pretty=None, wait_for_completion=None)

Cancels a task, if it can be cancelled through an API.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/tasks.html

Parameters:
  • task_id (int | str | None) – Cancel the task with specified task id (node_id:task_number)

  • actions (str | Sequence[str] | None) – A comma-separated list of actions that should be cancelled. Leave empty to cancel all.

  • nodes (Sequence[str] | None) – A comma-separated list of node IDs or names to limit the returned information; use _local to return information from the node you’re connecting to, leave empty to get information from all nodes

  • parent_task_id (str | None) – Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all.

  • wait_for_completion (bool | None) – Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get(*, task_id, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None, wait_for_completion=None)

Returns information about a task.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/tasks.html

Parameters:
  • task_id (str) – Return the task with specified id (node_id:task_number)

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Explicit operation timeout

  • wait_for_completion (bool | None) – Wait for the matching tasks to complete (default: false)

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

list(*, actions=None, detailed=None, error_trace=None, filter_path=None, group_by=None, human=None, master_timeout=None, node_id=None, parent_task_id=None, pretty=None, timeout=None, wait_for_completion=None)

Returns a list of tasks.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/tasks.html

Parameters:
  • actions (str | Sequence[str] | None) – Comma-separated list or wildcard expression of actions used to limit the request.

  • detailed (bool | None) – If true, the response includes detailed information about shard recoveries.

  • group_by (Literal['nodes', 'none', 'parents'] | str | None) – Key used to group tasks in the response.

  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • node_id (Sequence[str] | None) – Comma-separated list of node IDs or names used to limit returned information.

  • parent_task_id (str | None) – Parent task ID used to limit returned information. To return all tasks, omit this parameter or use a value of -1.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • wait_for_completion (bool | None) – If true, the request blocks until the operation is complete.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Text Structure

class elasticsearch.client.TextStructureClient(client)
Parameters:

client (BaseClient) –

find_structure(*, text_files, charset=None, column_names=None, delimiter=None, explain=None, format=None, grok_pattern=None, has_header_row=None, line_merge_size_limit=None, lines_to_sample=None, quote=None, should_trim_fields=None, timeout=None, timestamp_field=None, timestamp_format=None)

Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/find-structure.html

Parameters:
  • text_files (Sequence[Any]) –

  • charset (str | None) – The text’s character set. It must be a character set that is supported by the JVM that Elasticsearch uses. For example, UTF-8, UTF-16LE, windows-1252, or EUC-JP. If this parameter is not specified, the structure finder chooses an appropriate character set.

  • column_names (str | None) – If you have set format to delimited, you can specify the column names in a comma-separated list. If this parameter is not specified, the structure finder uses the column names from the header row of the text. If the text does not have a header role, columns are named “column1”, “column2”, “column3”, etc.

  • delimiter (str | None) – If you have set format to delimited, you can specify the character used to delimit the values in each row. Only a single character is supported; the delimiter cannot have multiple characters. By default, the API considers the following possibilities: comma, tab, semi-colon, and pipe (|). In this default scenario, all rows must have the same number of fields for the delimited format to be detected. If you specify a delimiter, up to 10% of the rows can have a different number of columns than the first row.

  • explain (bool | None) – If this parameter is set to true, the response includes a field named explanation, which is an array of strings that indicate how the structure finder produced its result.

  • format (str | None) – The high level structure of the text. Valid values are ndjson, xml, delimited, and semi_structured_text. By default, the API chooses the format. In this default scenario, all rows must have the same number of fields for a delimited format to be detected. If the format is set to delimited and the delimiter is not set, however, the API tolerates up to 5% of rows that have a different number of columns than the first row.

  • grok_pattern (str | None) – If you have set format to semi_structured_text, you can specify a Grok pattern that is used to extract fields from every message in the text. The name of the timestamp field in the Grok pattern must match what is specified in the timestamp_field parameter. If that parameter is not specified, the name of the timestamp field in the Grok pattern must match “timestamp”. If grok_pattern is not specified, the structure finder creates a Grok pattern.

  • has_header_row (bool | None) – If you have set format to delimited, you can use this parameter to indicate whether the column names are in the first row of the text. If this parameter is not specified, the structure finder guesses based on the similarity of the first row of the text to other rows.

  • line_merge_size_limit (int | None) – The maximum number of characters in a message when lines are merged to form messages while analyzing semi-structured text. If you have extremely long messages you may need to increase this, but be aware that this may lead to very long processing times if the way to group lines into messages is misdetected.

  • lines_to_sample (int | None) – The number of lines to include in the structural analysis, starting from the beginning of the text. The minimum is 2; If the value of this parameter is greater than the number of lines in the text, the analysis proceeds (as long as there are at least two lines in the text) for all of the lines.

  • quote (str | None) – If you have set format to delimited, you can specify the character used to quote the values in each row if they contain newlines or the delimiter character. Only a single character is supported. If this parameter is not specified, the default value is a double quote (“). If your delimited text format does not use quoting, a workaround is to set this argument to a character that does not appear anywhere in the sample.

  • should_trim_fields (bool | None) – If you have set format to delimited, you can specify whether values between delimiters should have whitespace trimmed from them. If this parameter is not specified and the delimiter is pipe (|), the default value is true. Otherwise, the default value is false.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Sets the maximum amount of time that the structure analysis make take. If the analysis is still running when the timeout expires then it will be aborted.

  • timestamp_field (str | None) – Optional parameter to specify the timestamp field in the file

  • timestamp_format (str | None) – The Java time format of the timestamp field in the text.

Return type:

ObjectApiResponse[Any]

Transforms

class elasticsearch.client.TransformClient(client)
Parameters:

client (BaseClient) –

delete_transform(*, transform_id, error_trace=None, filter_path=None, force=None, human=None, pretty=None, timeout=None)

Deletes an existing transform.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/delete-transform.html

Parameters:
  • transform_id (str) – Identifier for the transform.

  • force (bool | None) – If this value is false, the transform must be stopped before it can be deleted. If true, the transform is deleted regardless of its current state.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_transform(*, transform_id=None, allow_no_match=None, error_trace=None, exclude_generated=None, filter_path=None, from_=None, human=None, pretty=None, size=None)

Retrieves configuration information for transforms.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-transform.html

Parameters:
  • transform_id (str | Sequence[str] | None) – Identifier for the transform. It can be a transform identifier or a wildcard expression. You can get information for all transforms by using _all, by specifying * as the <transform_id>, or by omitting the <transform_id>.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no transforms that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • exclude_generated (bool | None) – Excludes fields that were automatically added when creating the transform. This allows the configuration to be in an acceptable format to be retrieved and then added to another cluster.

  • from – Skips the specified number of transforms.

  • size (int | None) – Specifies the maximum number of transforms to obtain.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_transform_stats(*, transform_id, allow_no_match=None, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, size=None, timeout=None)

Retrieves usage information for transforms.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/get-transform-stats.html

Parameters:
  • transform_id (str | Sequence[str]) – Identifier for the transform. It can be a transform identifier or a wildcard expression. You can get information for all transforms by using _all, by specifying * as the <transform_id>, or by omitting the <transform_id>.

  • allow_no_match (bool | None) – Specifies what to do when the request: 1. Contains wildcard expressions and there are no transforms that match. 2. Contains the _all string or no identifiers and there are no matches. 3. Contains wildcard expressions and there are only partial matches. If this parameter is false, the request returns a 404 status code when there are no matches or only partial matches.

  • from – Skips the specified number of transforms.

  • size (int | None) – Specifies the maximum number of transforms to obtain.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Controls the time to wait for the stats

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

preview_transform(*, transform_id=None, description=None, dest=None, error_trace=None, filter_path=None, frequency=None, human=None, latest=None, pivot=None, pretty=None, retention_policy=None, settings=None, source=None, sync=None, timeout=None)

Previews a transform.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/preview-transform.html

Parameters:
  • transform_id (str | None) – Identifier for the transform to preview. If you specify this path parameter, you cannot provide transform configuration details in the request body.

  • description (str | None) – Free text description of the transform.

  • dest (Mapping[str, Any] | None) – The destination for the transform.

  • frequency (Literal[-1] | ~typing.Literal[0] | str | None) – The interval between checks for changes in the source indices when the transform is running continuously. Also determines the retry interval in the event of transient failures while the transform is searching or indexing. The minimum value is 1s and the maximum is 1h.

  • latest (Mapping[str, Any] | None) – The latest method transforms the data by finding the latest document for each unique key.

  • pivot (Mapping[str, Any] | None) – The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields and the aggregation to reduce the data.

  • retention_policy (Mapping[str, Any] | None) – Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the destination index.

  • settings (Mapping[str, Any] | None) – Defines optional transform settings.

  • source (Mapping[str, Any] | None) – The source of the data for the transform.

  • sync (Mapping[str, Any] | None) – Defines the properties transforms require to run continuously.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_transform(*, transform_id, dest, source, defer_validation=None, description=None, error_trace=None, filter_path=None, frequency=None, human=None, latest=None, meta=None, pivot=None, pretty=None, retention_policy=None, settings=None, sync=None, timeout=None)

Instantiates a transform.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/put-transform.html

Parameters:
  • transform_id (str) – Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters.

  • dest (Mapping[str, Any]) – The destination for the transform.

  • source (Mapping[str, Any]) – The source of the data for the transform.

  • defer_validation (bool | None) – When the transform is created, a series of validations occur to ensure its success. For example, there is a check for the existence of the source indices and a check that the destination index is not part of the source index pattern. You can use this parameter to skip the checks, for example when the source index does not exist until after the transform is created. The validations are always run when you start the transform, however, with the exception of privilege checks.

  • description (str | None) – Free text description of the transform.

  • frequency (Literal[-1] | ~typing.Literal[0] | str | None) – The interval between checks for changes in the source indices when the transform is running continuously. Also determines the retry interval in the event of transient failures while the transform is searching or indexing. The minimum value is 1s and the maximum is 1h.

  • latest (Mapping[str, Any] | None) – The latest method transforms the data by finding the latest document for each unique key.

  • meta (Mapping[str, Any] | None) – Defines optional transform metadata.

  • pivot (Mapping[str, Any] | None) – The pivot method transforms the data by aggregating and grouping it. These objects define the group by fields and the aggregation to reduce the data.

  • retention_policy (Mapping[str, Any] | None) – Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the destination index.

  • settings (Mapping[str, Any] | None) – Defines optional transform settings.

  • sync (Mapping[str, Any] | None) – Defines the properties transforms require to run continuously.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

reset_transform(*, transform_id, error_trace=None, filter_path=None, force=None, human=None, pretty=None)

Resets an existing transform.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/reset-transform.html

Parameters:
  • transform_id (str) – Identifier for the transform. This identifier can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores. It has a 64 character limit and must start and end with alphanumeric characters.

  • force (bool | None) – If this value is true, the transform is reset regardless of its current state. If it’s false, the transform must be stopped before it can be reset.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

schedule_now_transform(*, transform_id, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None)

Schedules now a transform.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/schedule-now-transform.html

Parameters:
  • transform_id (str) – Identifier for the transform.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Controls the time to wait for the scheduling to take place

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

start_transform(*, transform_id, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, timeout=None)

Starts one or more transforms.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/start-transform.html

Parameters:
  • transform_id (str) – Identifier for the transform.

  • from – Restricts the set of transformed entities to those changed after this time. Relative times like now-30d are supported. Only applicable for continuous transforms.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • from_ (str | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stop_transform(*, transform_id, allow_no_match=None, error_trace=None, filter_path=None, force=None, human=None, pretty=None, timeout=None, wait_for_checkpoint=None, wait_for_completion=None)

Stops one or more transforms.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/stop-transform.html

Parameters:
  • transform_id (str) – Identifier for the transform. To stop multiple transforms, use a comma-separated list or a wildcard expression. To stop all transforms, use _all or * as the identifier.

  • allow_no_match (bool | None) – Specifies what to do when the request: contains wildcard expressions and there are no transforms that match; contains the _all string or no identifiers and there are no matches; contains wildcard expressions and there are only partial matches. If it is true, the API returns a successful acknowledgement message when there are no matches. When there are only partial matches, the API stops the appropriate transforms. If it is false, the request returns a 404 status code when there are no matches or only partial matches.

  • force (bool | None) – If it is true, the API forcefully stops the transforms.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response when wait_for_completion is true. If no response is received before the timeout expires, the request returns a timeout exception. However, the request continues processing and eventually moves the transform to a STOPPED state.

  • wait_for_checkpoint (bool | None) – If it is true, the transform does not completely stop until the current checkpoint is completed. If it is false, the transform stops as soon as possible.

  • wait_for_completion (bool | None) – If it is true, the API blocks until the indexer state completely stops. If it is false, the API returns immediately and the indexer is stopped asynchronously in the background.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

update_transform(*, transform_id, defer_validation=None, description=None, dest=None, error_trace=None, filter_path=None, frequency=None, human=None, meta=None, pretty=None, retention_policy=None, settings=None, source=None, sync=None, timeout=None)

Updates certain properties of a transform.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/update-transform.html

Parameters:
  • transform_id (str) – Identifier for the transform.

  • defer_validation (bool | None) – When true, deferrable validations are not run. This behavior may be desired if the source index does not exist until after the transform is created.

  • description (str | None) – Free text description of the transform.

  • dest (Mapping[str, Any] | None) – The destination for the transform.

  • frequency (Literal[-1] | ~typing.Literal[0] | str | None) – The interval between checks for changes in the source indices when the transform is running continuously. Also determines the retry interval in the event of transient failures while the transform is searching or indexing. The minimum value is 1s and the maximum is 1h.

  • meta (Mapping[str, Any] | None) – Defines optional transform metadata.

  • retention_policy (None | Mapping[str, Any]) – Defines a retention policy for the transform. Data that meets the defined criteria is deleted from the destination index.

  • settings (Mapping[str, Any] | None) – Defines optional transform settings.

  • source (Mapping[str, Any] | None) – The source of the data for the transform.

  • sync (Mapping[str, Any] | None) – Defines the properties transforms require to run continuously.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

upgrade_transforms(*, dry_run=None, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None)

Upgrades all transforms.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/upgrade-transforms.html

Parameters:
  • dry_run (bool | None) – When true, the request checks for updates but does not run them.

  • timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

Watcher

class elasticsearch.client.WatcherClient(client)
Parameters:

client (BaseClient) –

ack_watch(*, watch_id, action_id=None, error_trace=None, filter_path=None, human=None, pretty=None)

Acknowledges a watch, manually throttling the execution of the watch’s actions.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-ack-watch.html

Parameters:
  • watch_id (str) – Watch ID

  • action_id (str | Sequence[str] | None) – A comma-separated list of the action ids to be acked

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

activate_watch(*, watch_id, error_trace=None, filter_path=None, human=None, pretty=None)

Activates a currently inactive watch.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-activate-watch.html

Parameters:
  • watch_id (str) – Watch ID

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

deactivate_watch(*, watch_id, error_trace=None, filter_path=None, human=None, pretty=None)

Deactivates a currently active watch.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-deactivate-watch.html

Parameters:
  • watch_id (str) – Watch ID

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

delete_watch(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Removes a watch from Watcher.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-delete-watch.html

Parameters:
  • id (str) – Watch ID

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

execute_watch(*, id=None, action_modes=None, alternative_input=None, debug=None, error_trace=None, filter_path=None, human=None, ignore_condition=None, pretty=None, record_execution=None, simulated_actions=None, trigger_data=None, watch=None)

Forces the execution of a stored watch.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-execute-watch.html

Parameters:
  • id (str | None) – Identifier for the watch.

  • action_modes (Mapping[str, Literal['execute', 'force_execute', 'force_simulate', 'simulate', 'skip'] | str] | None) – Determines how to handle the watch actions as part of the watch execution.

  • alternative_input (Mapping[str, Any] | None) – When present, the watch uses this object as a payload instead of executing its own input.

  • debug (bool | None) – Defines whether the watch runs in debug mode.

  • ignore_condition (bool | None) – When set to true, the watch execution uses the always condition. This can also be specified as an HTTP parameter.

  • record_execution (bool | None) – When set to true, the watch record representing the watch execution result is persisted to the .watcher-history index for the current time. In addition, the status of the watch is updated, possibly throttling subsequent executions. This can also be specified as an HTTP parameter.

  • simulated_actions (Mapping[str, Any] | None) –

  • trigger_data (Mapping[str, Any] | None) – This structure is parsed as the data of the trigger event that will be used during the watch execution

  • watch (Mapping[str, Any] | None) – When present, this watch is used instead of the one specified in the request. This watch is not persisted to the index and record_execution cannot be set.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_watch(*, id, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves a watch by its ID.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-get-watch.html

Parameters:
  • id (str) – Watch ID

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

put_watch(*, id, actions=None, active=None, condition=None, error_trace=None, filter_path=None, human=None, if_primary_term=None, if_seq_no=None, input=None, metadata=None, pretty=None, throttle_period=None, transform=None, trigger=None, version=None)

Creates a new watch, or updates an existing one.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-put-watch.html

Parameters:
  • id (str) – Watch ID

  • actions (Mapping[str, Mapping[str, Any]] | None) –

  • active (bool | None) – Specify whether the watch is in/active by default

  • condition (Mapping[str, Any] | None) –

  • if_primary_term (int | None) – only update the watch if the last operation that has changed the watch has the specified primary term

  • if_seq_no (int | None) – only update the watch if the last operation that has changed the watch has the specified sequence number

  • input (Mapping[str, Any] | None) –

  • metadata (Mapping[str, Any] | None) –

  • throttle_period (str | None) –

  • transform (Mapping[str, Any] | None) –

  • trigger (Mapping[str, Any] | None) –

  • version (int | None) – Explicit version number for concurrency control

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

query_watches(*, error_trace=None, filter_path=None, from_=None, human=None, pretty=None, query=None, search_after=None, size=None, sort=None)

Retrieves stored watches.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-query-watches.html

Parameters:
  • from – The offset from the first result to fetch. Needs to be non-negative.

  • query (Mapping[str, Any] | None) – Optional, query filter watches to be returned.

  • search_after (Sequence[None | bool | float | int | str | Any] | None) – Optional search After to do pagination using last hit’s sort values.

  • size (int | None) – The number of hits to return. Needs to be non-negative.

  • sort (Sequence[str | Mapping[str, Any]] | str | Mapping[str, Any] | None) – Optional sort definition.

  • error_trace (bool | None) –

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

  • from_ (int | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

start(*, error_trace=None, filter_path=None, human=None, pretty=None)

Starts Watcher if it is not already running.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-start.html

Parameters:
Return type:

ObjectApiResponse[Any]

stats(*, metric=None, emit_stacktraces=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves the current Watcher metrics.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-stats.html

Parameters:
  • metric (Sequence[Literal['_all', 'current_watches', 'pending_watches', 'queued_watches'] | str] | ~typing.Literal['_all', 'current_watches', 'pending_watches', 'queued_watches'] | str | None) – Defines which additional metrics are included in the response.

  • emit_stacktraces (bool | None) – Defines whether stack traces are generated for each watch that is running.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

stop(*, error_trace=None, filter_path=None, human=None, pretty=None)

Stops Watcher if it is running.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/watcher-api-stop.html

Parameters:
Return type:

ObjectApiResponse[Any]

X-Pack

class elasticsearch.client.XPackClient(client)
Parameters:

client (BaseClient) –

info(*, accept_enterprise=None, categories=None, error_trace=None, filter_path=None, human=None, pretty=None)

Retrieves information about the installed X-Pack features.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/info-api.html

Parameters:
  • accept_enterprise (bool | None) – If this param is used it must be set to true

  • categories (Sequence[str] | None) – A comma-separated list of the information categories to include in the response. For example, build,license,features.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

usage(*, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)

Retrieves usage information about the installed X-Pack features.

https://www.elastic.co/guide/en/elasticsearch/reference/8.10/usage-api.html

Parameters:
  • master_timeout (Literal[-1] | ~typing.Literal[0] | str | None) – Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error.

  • error_trace (bool | None) –

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

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]