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 (