Indices Client

class opensearchpy.client.indices.IndicesClient(client)[source]

Bases: NamespacedClient

Parameters:

client (Any) –

add_block(index, block, params=None, headers=None)[source]

Adds a block to an index.

Parameters:
  • index (Any) – A comma separated list of indices to add a block to

  • block (Any) – The block to add (one of read, write, read_only or metadata)

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

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): Specify timeout for connection to master

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Explicit operation timeout

  • index

  • block

  • params (Any) –

  • headers (Any) –

Return type:

Any

analyze(body=None, index=None, params=None, headers=None)[source]

Performs the analysis process on a text and return the tokens breakdown of the text.

Parameters:
  • body (Any) – Define analyzer/tokenizer parameters and the text on which the analysis should be performed

  • index (Any) – The name of the index to scope the operation.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • body

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

clear_cache(index=None, params=None, headers=None)[source]

Clears all or specific caches for one or more indices.

Parameters:
  • index (Any) – Comma-separated list of indices; use _all or empty string to perform the operation on all indices.

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

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • fielddata – If true, clears the fields cache.Use the fields parameter to clear the cache of specific fields only.

  • fields – Comma-separated list of field names used to limit the fielddata parameter.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • pretty – Whether to pretty format the returned JSON response.

  • query – If true, clears the query cache.

  • request – If true, clears the request cache.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

clone(index, target, body=None, params=None, headers=None)[source]

Clones an index.

Parameters:
  • index (Any) – Name of the source index to clone.

  • target (Any) – Name of the target index to create.

  • body (Any) – The configuration for the target index (settings and aliases)

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • task_execution_timeout – Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.

  • timeout – 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 – The number of shard copies that must be active before proceeding with the operation.Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). Valid choices are all, index-setting.

  • wait_for_completion – Should this request wait until the operation has completed before returning. Default is True.

  • index

  • target

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

close(index, params=None, headers=None)[source]

Closes an index.

Parameters:
  • index (Any) – Comma-separated list or wildcard expression of index names used to limit the request.

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

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – 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 – The number of shard copies that must be active before proceeding with the operation.Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). Valid choices are all, index-setting.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

create(index, body=None, params=None, headers=None)[source]

Creates an index with optional settings and mappings.

Parameters:
  • index (Any) – Name of the index you wish to create.

  • body (Any) – The configuration for the index (settings and mappings)

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – 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 – The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). Valid choices are all, index-setting.

  • index

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

create_data_stream(name, body=None, params=None, headers=None)[source]

Creates or updates a data stream.

Parameters:
  • name (Any) – Name of the data stream, which must meet the following criteria: Lowercase only; Cannot include /, *, ?, , <, >, |, ,, #, :, backslash, or a space character; Cannot start with -, _, +, or .ds-; Cannot be . or ..; Cannot be longer than 255 bytes. Multi-byte characters count towards this limit faster.

  • body (Any) – The data stream definition

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

data_streams_stats(name=None, params=None, headers=None)[source]

Provides statistics on operations happening in a data stream.

Parameters:
  • name (Any) – Comma-separated list of data streams used to limit the request. Wildcard expressions (*) are supported. To target all data streams in a cluster, omit this parameter or use *.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

delete(index, params=None, headers=None)[source]

Deletes an index.

Parameters:
  • index (Any) – Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not support wildcards (*) or _all. To use wildcards or _all, set the action.destructive_requires_name cluster setting to false.

  • allow_no_indices – 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. Default is false.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • ignore_unavailable – If false, the request returns an error if it targets a missing or closed index. Default is false.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

delete_alias(index, name, params=None, headers=None)[source]

Deletes an alias.

Parameters:
  • index (Any) – Comma-separated list of data streams or indices used to limit the request. Supports wildcards (*).

  • name (Any) – Comma-separated list of aliases to remove. Supports wildcards (*). To remove all aliases, use * or _all.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.

  • index

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

delete_data_stream(name, params=None, headers=None)[source]

Deletes a data stream.

Parameters:
  • name (Any) – Comma-separated list of data streams to delete. Wildcard (*) expressions are supported.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

delete_index_template(name, params=None, headers=None)[source]

Deletes an index template.

Parameters:
  • name (Any) – Name of the index template to delete. Wildcard (*) expressions are supported.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

delete_template(name, params=None, headers=None)[source]

Deletes an index template.

Parameters:
  • name (Any) – The name of the legacy index template to delete. Wildcard (*) expressions are supported.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

exists(index, params=None, headers=None)[source]

Returns information about whether a particular index exists.

Parameters:
  • index (Any) – Comma-separated list of data streams, indices, and aliases. Supports wildcards (*).

  • allow_no_indices – 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. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flat_settings – If true, returns settings in flat format. Default is false.

  • human – Whether to return human readable values for statistics.

  • ignore_unavailable – If false, the request returns an error if it targets a missing or closed index. Default is false.

  • include_defaults – If true, return all default settings in the response. Default is false.

  • local – If true, the request retrieves information from the local node only. Default is false.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

exists_alias(name, index=None, params=None, headers=None)[source]

Returns information about whether a particular alias exists.

Parameters:
  • name (Any) – Comma-separated list of aliases to check. Supports wildcards (*).

  • index (Any) – Comma-separated list of data streams or indices used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all.

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

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • ignore_unavailable – If false, requests that include a missing data stream or index in the target indices or data streams return an error.

  • local – If true, the request retrieves information from the local node only. Default is false.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

exists_index_template(name, params=None, headers=None)[source]

Returns information about whether a particular index template exists.

Parameters:
  • name (Any) – Name of the index template to check existence of. Wildcard (*) expressions are supported.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flat_settings – Return settings in flat format. Default is false.

  • human – Whether to return human readable values for statistics.

  • local – Return local information, do not retrieve the state from cluster-manager node. Default is false.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

exists_template(name, params=None, headers=None)[source]

Returns information about whether a particular index template exists.

Parameters:
  • name (Any) – The comma separated names of the index templates

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flat_settings – Return settings in flat format. Default is false.

  • human – Whether to return human readable values for statistics.

  • local – Return local information, do not retrieve the state from cluster-manager node. Default is false.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): Explicit operation timeout for connection to master node

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

flush(index=None, params=None, headers=None)[source]

Performs the flush operation on one or more indices.

Parameters:
  • index (Any) – Comma-separated list of data streams, indices, and aliases to flush. Supports wildcards (*). To flush all data streams and indices, omit this parameter or use * or _all.

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

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • force – If true, the request forces a flush even if there are no changes to commit to the index.

  • human – Whether to return human readable values for statistics.

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

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • wait_if_ongoing – If true, the flush operation blocks until execution when another flush operation is running.If false, Opensearch returns an error if you request a flush when another flush operation is running. Default is True.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

forcemerge(index=None, params=None, headers=None)[source]

Performs the force merge operation on one or more indices.

Parameters:
  • index (Any) – A comma-separated list of index names; use _all or empty string to perform the operation on all indices

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

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flush – Specify whether the index should be flushed after performing the operation. Default is True.

  • human – Whether to return human readable values for statistics.

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

  • max_num_segments – The number of larger segments into which smaller segments are merged.Set this parameter to 1 to merge all segments into one segment.The default behavior is to perform the merge as necessary.

  • only_expunge_deletes – Specify whether the operation should only expunge deleted documents

  • pretty – Whether to pretty format the returned JSON response.

  • primary_only – Specify whether the operation should only perform on primary shards. Defaults to false. Default is false.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • wait_for_completion – Should the request wait until the force merge is completed. Default is True.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

get(index, params=None, headers=None)[source]

Returns information about one or more indices.

Parameters:
  • index (Any) – Comma-separated list of data streams, indices, and index aliases used to limit the request. Wildcard expressions (*) are supported.

  • allow_no_indices – If false, the request returns an error if any wildcard expression, index alias, or _all value targets onlymissing 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. Default is false.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard expressions can match. If the request can target data streams, this argumentdetermines whether wildcard expressions match hidden data streams. Supports comma-separated values,such as open,hidden. Valid choices are all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flat_settings – If true, returns settings in flat format. Default is false.

  • human – Whether to return human readable values for statistics.

  • ignore_unavailable – If false, requests that target a missing index return an error. Default is false.

  • include_defaults – If true, return all default settings in the response. Default is false.

  • local – If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. Default is false.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

get_alias(index=None, name=None, params=None, headers=None)[source]

Returns an alias.

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

  • name (Any) – Comma-separated list of aliases to retrieve. Supports wildcards (*). To retrieve all aliases, omit this parameter or use * or _all.

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

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • local – If true, the request retrieves information from the local node only. Default is false.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

get_data_stream(name=None, params=None, headers=None)[source]

Returns data streams.

Parameters:
  • name (Any) – Comma-separated list of data stream names used to limit the request. Wildcard (*) expressions are supported. If omitted, all data streams are returned.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

get_field_mapping(fields, index=None, params=None, headers=None)[source]

Returns mapping for one or more fields.

Parameters:
  • fields (Any) – Comma-separated list or wildcard expression of fields used to limit returned information.

  • index (Any) – 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 – 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.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • include_defaults – If true, return all default settings in the response.

  • local – If true, the request retrieves information from the local node only. Default is false.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • fields

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

get_index_template(name=None, params=None, headers=None)[source]

Returns an index template.

Parameters:
  • name (Any) – Name of the index template to retrieve. Wildcard (*) expressions are supported.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flat_settings – If true, returns settings in flat format. Default is false.

  • human – Whether to return human readable values for statistics.

  • local – If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the master node. Default is false.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

get_mapping(index=None, params=None, headers=None)[source]

Returns mappings for one or more indices.

Parameters:
  • index (Any) – 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 – 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.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • local – If true, the request retrieves information from the local node only. Default is false.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

get_settings(index=None, name=None, params=None, headers=None)[source]

Returns settings for one or more indices.

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

  • name (Any) – Comma-separated list or wildcard expression of settings to retrieve.

  • allow_no_indices – If false, the request returns an error if any wildcard expression, indexalias, or _all value targets only missing or closed indices. Thisbehavior applies even if the request targets other open indices. Forexample, a request targeting foo*,bar* returns an error if an indexstarts with foo but no index starts with bar.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden. Valid choices are all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flat_settings – If true, returns settings in flat format. Default is false.

  • human – Whether to return human readable values for statistics.

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

  • include_defaults – If true, return all default settings in the response. Default is false.

  • local – If true, the request retrieves information from the local node only. If`false`, information is retrieved from the master node. Default is false.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): Period to wait for a connection to the master node. If no response isreceived before the timeout expires, the request fails and returns anerror.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

get_template(name=None, params=None, headers=None)[source]

Returns an index template.

Parameters:
  • name (Any) – Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. To return all index templates, omit this parameter or use a value of _all or *.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flat_settings – If true, returns settings in flat format. Default is false.

  • human – Whether to return human readable values for statistics.

  • local – If true, the request retrieves information from the local node only. Default is false.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

get_upgrade(index=None, params=None, headers=None)[source]

The _upgrade API is no longer useful and will be removed.

Parameters:
  • index (Any) – Comma-separated list of indices; use _all or empty string to perform the operation on all indices.

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

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

open(index, params=None, headers=None)[source]

Opens an index.

Parameters:
  • index (Any) – Comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). By default, you must explicitly name the indices you using to limit the request. To limit a request using _all, *, or other wildcard expressions, change the action.destructive_requires_name setting to false. You can update this setting in the opensearch.yml file or using the cluster update settings API.

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

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • task_execution_timeout – Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.

  • timeout – 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 – The number of shard copies that must be active before proceeding with the operation.Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). Valid choices are all, index-setting.

  • wait_for_completion – Should this request wait until the operation has completed before returning. Default is True.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

put_alias(index, name, body=None, params=None, headers=None)[source]

Creates or updates an alias.

Parameters:
  • index (Any) – Comma-separated list of data streams or indices to add. Supports wildcards (*). Wildcard patterns that match both data streams and indices return an error.

  • name (Any) – Alias to update. If the alias doesn’t exist, the request creates it. Index alias names support date math.

  • body (Any) – The settings for the alias, such as routing or filter

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.

  • index

  • name

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

put_index_template(name, body, params=None, headers=None)[source]

Creates or updates an index template.

Parameters:
  • name (Any) – Index or template name

  • body (Any) – The template definition

  • cause – User defined reason for creating/updating the index template. Default is false.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • create – If true, this request cannot replace or update existing index templates. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): Operation timeout for connection to master node.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

put_mapping(body, index=None, params=None, headers=None)[source]

Updates the index mappings.

Parameters:
  • body (Any) – The mapping definition

  • index (Any) – Comma-separated list of indices; use _all or empty string to perform the operation on all indices.

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

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.

  • write_index_only – If true, the mappings are applied only to the current write index for the target. Default is false.

  • body

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

put_settings(body, index=None, params=None, headers=None)[source]

Updates the index settings.

Parameters:
  • index (Any) – 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 – If false, the request returns an error if any wildcard expression, indexalias, or _all value targets only missing or closed indices. Thisbehavior applies even if the request targets other open indices. Forexample, a request targeting foo*,bar* returns an error if an indexstarts with foo but no index starts with bar.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match. If the request can targetdata streams, this argument determines whether wildcard expressions matchhidden data streams. Supports comma- separated values, such as`open,hidden`. Valid choices are all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • flat_settings – If true, returns settings in flat format. Default is false.

  • human – Whether to return human readable values for statistics.

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

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): Period to wait for a connection to the master node. If no response isreceived before the timeout expires, the request fails and returns anerror.

  • preserve_existing – If true, existing index settings remain unchanged. Default is false.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error.

  • body (Any) –

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

put_template(name, body, params=None, headers=None)[source]

Creates or updates an index template.

Parameters:
  • name (Any) – The name of the template

  • body (Any) – The template definition

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • create – If true, this request cannot replace or update existing index templates. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): Period to wait for a connection to the master node. If no response isreceived before the timeout expires, the request fails and returns an error.

  • order – Order in which Opensearch applies this template if indexmatches multiple templates.Templates with lower ‘order’ values are merged first. Templates with higher’order’ values are merged later, overriding templates with lower values.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

recovery(index=None, params=None, headers=None)[source]

Returns information about ongoing index shard recoveries.

Parameters:
  • index (Any) – 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 – If true, the response only includes ongoing shard recoveries. Default is false.

  • detailed – If true, the response includes detailed information about shard recoveries. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

refresh(index=None, params=None, headers=None)[source]

Performs the refresh operation in one or more indices.

Parameters:
  • index (Any) – 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 – 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.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

resolve_index(name, params=None, headers=None)[source]

Returns information about any matching indices, aliases, and data streams.

Parameters:
  • name (Any) – Comma-separated name(s) or index pattern(s) of the indices, aliases, and data streams to resolve. Resources on remote clusters can be specified using the <cluster>:<name> syntax.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

rollover(alias, body=None, new_index=None, params=None, headers=None)[source]

Updates an alias to point to a new index when the existing index is considered to be too large or too old.

Parameters:
  • alias (Any) – Name of the data stream or index alias to roll over.

  • body (Any) – The conditions that needs to be met for executing rollover

  • new_index (Any) – Name of the index to create. Supports date math. Data streams do not support this parameter.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • dry_run – If true, checks whether the current index satisfies the specified conditions but does not perform a rollover. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – 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 – The number of shard copies that must be active before proceeding with the operation.Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). Valid choices are all, index-setting.

  • alias

  • body

  • new_index

  • params (Any) –

  • headers (Any) –

Return type:

Any

segments(index=None, params=None, headers=None)[source]

Provides low-level information about segments in a Lucene index.

Parameters:
  • index (Any) – 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 – 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.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • verbose – If true, the request returns a verbose response. Default is false.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

shard_stores(index=None, params=None, headers=None)[source]

Provides store information for shard copies of indices.

Parameters:
  • index (Any) – List of data streams, indices, and aliases used to limit the request.

  • allow_no_indices – If false, the request returns an error if any wildcard expression, index alias, or _allvalue targets only missing or closed indices. This behavior applies even if the requesttargets other open indices.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – 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. Valid choices are all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • ignore_unavailable – If true, missing or closed indices are not included in the response.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • status – List of shard health statuses used to limit the request.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

shrink(index, target, body=None, params=None, headers=None)[source]

Allow to shrink an existing index into a new index with fewer primary shards.

Parameters:
  • index (Any) – Name of the source index to shrink.

  • target (Any) – Name of the target index to create.

  • body (Any) – The configuration for the target index (settings and aliases)

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • copy_settings – whether or not to copy settings from the source index. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • task_execution_timeout – Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.

  • timeout – 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 – The number of shard copies that must be active before proceeding with the operation.Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). Valid choices are all, index-setting.

  • wait_for_completion – Should this request wait until the operation has completed before returning. Default is True.

  • index

  • target

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

simulate_index_template(name, body=None, params=None, headers=None)[source]

Simulate matching the given index name against the index templates in the system.

Parameters:
  • name (Any) – Index or template name to simulate

  • body (Any) – New index template definition, which will be included in the simulation, as if it already exists in the system

  • cause – User defined reason for dry-run creating the new template for simulation purposes. Default is false.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • create – If true, the template passed in the body is only used if no existingtemplates match the same index patterns. If false, the simulation usesthe template with the highest priority. Note that the template is notpermanently added or updated in either case; it is only used for thesimulation. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): Period to wait for a connection to the master node. If no response is receivedbefore the timeout expires, the request fails and returns an error.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • name

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

simulate_template(body=None, name=None, params=None, headers=None)[source]

Simulate resolving the given template name or body.

Parameters:
  • name (Any) – Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter and specify the template configuration in the request body.

  • cause – User defined reason for dry-run creating the new template for simulation purposes. Default is false.

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • create – If true, the template passed in the body is only used if no existing templates match the same index patterns. If false, the simulation uses the template with the highest priority. Note that the template is not permanently added or updated in either case; it is only used for the simulation. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • body (Any) –

  • name

  • params (Any) –

  • headers (Any) –

Return type:

Any

split(index, target, body=None, params=None, headers=None)[source]

Allows you to split an existing index into a new index with more primary shards.

Parameters:
  • index (Any) – Name of the source index to split.

  • target (Any) – Name of the target index to create.

  • body (Any) – The configuration for the target index (settings and aliases)

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • copy_settings – whether or not to copy settings from the source index. Default is false.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • task_execution_timeout – Explicit task execution timeout, only useful when wait_for_completion is false, defaults to 1h.

  • timeout – 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 – The number of shard copies that must be active before proceeding with the operation.Set to all or any positive integer up to the total number of shards in the index (number_of_replicas+1). Valid choices are all, index-setting.

  • wait_for_completion – Should this request wait until the operation has completed before returning. Default is True.

  • index

  • target

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

stats(index=None, metric=None, params=None, headers=None)[source]

Provides statistics on operations happening in an index.

Parameters:
  • index (Any) – A comma-separated list of index names; use _all or empty string to perform the operation on all indices

  • metric (Any) – Limit the information returned the specific metrics.

  • completion_fields – Comma-separated list or wildcard expressions of fields to include in fielddata and suggest statistics.

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match. If the request can target data streams, this argumentdetermines whether wildcard expressions match hidden data streams. Supports comma- separated values,such as open,hidden. Valid choices are all, open, closed, hidden, none.

  • fielddata_fields – Comma-separated list or wildcard expressions of fields to include in fielddata statistics.

  • fields – Comma-separated list or wildcard expressions of fields to include in the statistics.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • forbid_closed_indices – If true, statistics are not collected from closed indices. Default is True.

  • groups – Comma-separated list of search groups to include in the search statistics.

  • human – Whether to return human readable values for statistics.

  • include_segment_file_sizes – If true, the call reports the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested). Default is false.

  • include_unloaded_segments – If true, the response includes information from segments that are not loaded into memory. Default is false.

  • level – Indicates whether statistics are aggregated at the cluster, index, or shard level. Valid choices are cluster, indices, shards.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • index

  • metric

  • params (Any) –

  • headers (Any) –

Return type:

Any

update_aliases(body, params=None, headers=None)[source]

Updates index aliases.

Parameters:
  • body (Any) – The definition of actions to perform

  • cluster_manager_timeout – Operation timeout for connection to cluster-manager node.

  • error_trace – Whether to include the stack trace of returned errors.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

  • (Deprecated (master_timeout) – To promote inclusive language, use ‘cluster_manager_timeout’ instead.): 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.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • timeout – Period to wait for a response.If no response is received before the timeout expires, the request fails and returns an error.

  • body

  • params (Any) –

  • headers (Any) –

Return type:

Any

upgrade(index=None, params=None, headers=None)[source]

The _upgrade API is no longer useful and will be removed.

Parameters:
  • index (Any) – Comma-separated list of indices; use _all or empty string to perform the operation on all indices.

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

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Whether to expand wildcard expression to concrete indices that are open, closed or both. Valid choices are all, open, closed, hidden, none.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • only_ancient_segments – If true, only ancient (an older Lucene major release) segments will be upgraded.

  • pretty – Whether to pretty format the returned JSON response.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • wait_for_completion – Should this request wait until the operation has completed before returning. Default is false.

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any

validate_query(body=None, index=None, params=None, headers=None)[source]

Allows a user to validate a potentially expensive query without executing it.

Parameters:
  • body (Any) – The query definition specified with the Query DSL

  • index (Any) – Comma-separated list of data streams, indices, and aliases to search. Supports wildcards (*). To search all data streams or indices, omit this parameter or use * or _all.

  • all_shards – If true, the validation is executed on all shards instead of one random shard per index.

  • allow_no_indices – If false, the request returns an error if any wildcard expression, index alias, or _all value targets only missing or closed indices.This behavior applies even if the request targets other open indices.

  • analyze_wildcard – If true, wildcard and prefix queries are analyzed. Default is false.

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

  • default_operator – The default operator for query string query: AND or OR. Valid choices are and, or.

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

  • error_trace – Whether to include the stack trace of returned errors.

  • expand_wildcards – Type of index that wildcard patterns can match.If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams.Supports comma- separated values, such as open,hidden.Valid values are: all, open, closed, hidden, none.

  • explain – If true, the response returns detailed information if an error has occurred.

  • filter_path – Comma-separated list of filters used to reduce the response.

  • human – Whether to return human readable values for statistics.

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

  • lenient – If true, format-based query failures (such as providing text to a numeric field) in the query string will be ignored.

  • pretty – Whether to pretty format the returned JSON response.

  • q – Query in the Lucene query string syntax.

  • rewrite – If true, returns a more detailed explanation showing the actual Lucene query that will be executed.

  • source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

  • body

  • index

  • params (Any) –

  • headers (Any) –

Return type:

Any