Cluster Client
- class opensearchpy.client.cluster.ClusterClient(client)[source]
Bases:
NamespacedClient
- Parameters:
client (Any) –
- allocation_explain(body=None, params=None, headers=None)[source]
Provides explanations for shard allocations in the cluster.
- Parameters:
body (Any) – The index, shard, and primary flag to explain. Empty means ‘explain the first unassigned shard’
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
include_disk_info – If true, returns information about disk usage and shard sizes. Default is false.
include_yes_decisions – If true, returns YES decisions in explanation. Default is false.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
body –
params (Any) –
headers (Any) –
- Return type:
- delete_component_template(name, params=None, headers=None)[source]
Deletes a component template.
- Parameters:
name (Any) – Name of the component 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. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
(Deprecated (master_timeout) – To promote inclusive language, use cluster_manager_timeout instead.): Period to wait for a connection to the cluster-manager 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. Default is false.
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:
- delete_decommission_awareness(params=None, headers=None)[source]
Delete any existing decommission.
- Parameters:
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
params (Any) –
headers (Any) –
- Return type:
- delete_voting_config_exclusions(params=None, headers=None)[source]
Clears cluster voting config exclusions.
- Parameters:
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. 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_removal – 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. Default is True.
params (Any) –
headers (Any) –
- Return type:
- delete_weighted_routing(body=None, params=None, headers=None)[source]
Delete weighted shard routing weights.
- Parameters:
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
body (Any) –
params (Any) –
headers (Any) –
- Return type:
- exists_component_template(name, params=None, headers=None)[source]
Returns information about whether a particular component template exist.
- Parameters:
name (Any) – Name of the component 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. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
local – If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the 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 cluster-manager 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. Default is false.
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:
- get_component_template(name=None, params=None, headers=None)[source]
Returns one or more component templates.
- Parameters:
name (Any) – Name of the component 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. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
local – If true, the request retrieves information from the local node only. If false, information is retrieved from the 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 cluster-manager 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. Default is false.
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:
- get_decommission_awareness(awareness_attribute_name, params=None, headers=None)[source]
Get details and status of decommissioned attribute.
- Parameters:
awareness_attribute_name (Any) – Awareness attribute name.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
awareness_attribute_name –
params (Any) –
headers (Any) –
- Return type:
- get_settings(params=None, headers=None)[source]
Returns cluster settings.
- Parameters:
cluster_manager_timeout – Operation timeout for connection to cluster-manager node.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
flat_settings – If true, returns settings in flat format. Default is false.
human – Whether to return human readable values for statistics. Default is True.
include_defaults – If true, returns default cluster settings from the local node. Default is false.
(Deprecated (master_timeout) – To promote inclusive language, use cluster_manager_timeout instead.): Period to wait for a connection to the cluster-manager 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. Default is false.
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.
params (Any) –
headers (Any) –
- Return type:
- get_weighted_routing(attribute, params=None, headers=None)[source]
Fetches weighted shard routing weights.
- Parameters:
attribute (Any) – Awareness attribute name.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
attribute –
params (Any) –
headers (Any) –
- Return type:
- health(index=None, params=None, headers=None)[source]
Returns basic information about the health of the cluster.
- Parameters:
index (Any) – Comma-separated list of data streams, indexes, and index aliases used to limit the request. Wildcard expressions (*) are supported. To target all data streams and indexes in a cluster, omit this parameter or use _all or *.
awareness_attribute – The awareness attribute for which the health is required.
cluster_manager_timeout – Operation timeout for connection to cluster-manager node.
error_trace – Whether to include the stack trace of returned errors. Default is false.
expand_wildcards – Whether to expand wildcard expression to concrete indexes that are open, closed or both.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
level – Can be one of cluster, indexes or shards. Controls the details level of the health information returned. Valid choices are awareness_attributes, cluster, indices, shards.
local – If true, the request retrieves information from the local node only. Defaults to false, which means information is retrieved from the 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 cluster-manager 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. Default is false.
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 – 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. Valid choices are all, index-setting.
wait_for_events – Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are processed. Valid choices are high, immediate, languid, low, normal, urgent.
wait_for_no_initializing_shards – 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 – 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 – 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 – 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. Valid choices are green, red, yellow.
index –
params (Any) –
headers (Any) –
- Return type:
- pending_tasks(params=None, headers=None)[source]
Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been executed.
- Parameters:
cluster_manager_timeout – Operation timeout for connection to cluster-manager node.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
local – If true, the request retrieves information from the local node only. If false, information is retrieved from the 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 cluster-manager 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. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
params (Any) –
headers (Any) –
- Return type:
- post_voting_config_exclusions(params=None, headers=None)[source]
Updates the cluster voting config exclusions by node ids or node names.
- Parameters:
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
node_ids – 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 – 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.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
timeout – 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.
params (Any) –
headers (Any) –
- Return type:
- put_component_template(name, body, params=None, headers=None)[source]
Creates or updates a component template.
- Parameters:
name (Any) – Name of the component template to create. OpenSearch includes the following built-in component templates: logs-mappings; ‘logs-settings`; metrics-mappings; metrics-settings;`synthetics- mapping`; synthetics-settings. OpenSearch Agent uses these templates to configure backing indexes for its data streams. If you use OpenSearch 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 OpenSearch Agent and want to disable all built-in component and index templates, set stack.templates.enabled to false using the cluster update settings API.
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 component templates. Default is false.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
(Deprecated (master_timeout) – To promote inclusive language, use cluster_manager_timeout instead.): Period to wait for a connection to the cluster-manager 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. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
timeout – Operation timeout.
name –
body –
params (Any) –
headers (Any) –
- Return type:
- put_decommission_awareness(awareness_attribute_name, awareness_attribute_value, params=None, headers=None)[source]
Decommissions an awareness attribute.
- Parameters:
awareness_attribute_name (Any) – Awareness attribute name.
awareness_attribute_value (Any) – Awareness attribute value.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
awareness_attribute_name –
awareness_attribute_value –
params (Any) –
headers (Any) –
- Return type:
- put_settings(body, params=None, headers=None)[source]
Updates the cluster settings.
- Parameters:
body (Any) – The settings to be updated. Can be either transient or persistent (survives cluster restart).
cluster_manager_timeout – Operation timeout for connection to cluster-manager node.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
flat_settings – Return settings in flat format. Default is false.
human – Whether to return human readable values for statistics. Default is True.
(Deprecated (master_timeout) – To promote inclusive language, use cluster_manager_timeout instead.): Explicit operation timeout for connection to cluster-manager node
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
timeout – Explicit operation timeout
body –
params (Any) –
headers (Any) –
- Return type:
- put_weighted_routing(attribute, body=None, params=None, headers=None)[source]
Updates weighted shard routing weights.
- Parameters:
attribute (Any) – Awareness attribute name.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
attribute –
body (Any) –
params (Any) –
headers (Any) –
- Return type:
- remote_info(params=None, headers=None)[source]
Returns the information about configured remote clusters.
- Parameters:
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. Default is false.
source – The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.
params (Any) –
headers (Any) –
- Return type:
- reroute(body=None, params=None, headers=None)[source]
Allows to manually change the allocation of individual shards in the cluster.
- Parameters:
body (Any) – The definition of commands to perform (move, cancel, allocate)
cluster_manager_timeout – Operation timeout for connection to cluster-manager node.
dry_run – If true, then the request simulates the operation only and returns the resulting state.
error_trace – Whether to include the stack trace of returned errors. Default is false.
explain – If true, then the response contains an explanation of why the commands can or cannot be executed.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
human – Whether to return human readable values for statistics. Default is True.
(Deprecated (master_timeout) – To promote inclusive language, use cluster_manager_timeout instead.): Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails and returns an error.
metric – Limits the information returned to the specified metrics.
pretty – Whether to pretty format the returned JSON response. Default is false.
retry_failed – If true, then retries allocation of shards that are blocked due to too many subsequent allocation failures.
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:
- state(metric=None, index=None, params=None, headers=None)[source]
Returns a comprehensive information about the state of the cluster.
- Parameters:
metric (Any) – Limit the information returned to the specified metrics
index (Any) – A comma-separated list of index names; use _all or empty string to perform the operation on all indexes
allow_no_indices – Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or when no indexes 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. Default is false.
expand_wildcards – Whether to expand wildcard expression to concrete indexes that are open, closed or both.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
flat_settings – Return settings in flat format. Default is false.
human – Whether to return human readable values for statistics. Default is True.
ignore_unavailable – Whether specified concrete indexes should be ignored when unavailable (missing or closed)
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.): Specify timeout for connection to cluster manager.
pretty – Whether to pretty format the returned JSON response. 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_metadata_version – Wait for the metadata version to be equal or greater than the specified metadata version.
wait_for_timeout – The maximum time to wait for wait_for_metadata_version before timing out.
metric –
index –
params (Any) –
headers (Any) –
- Return type:
- stats(node_id=None, params=None, headers=None, metric=None, index_metric=None)[source]
Returns high-level overview of cluster statistics.
- Parameters:
metric (Any) – Limit the information returned to the specified metrics.
index_metric (Any) – Limit the information returned for indexes metric to the specific index metrics. It can be used only if indexes (or all) metric is specified.
node_id (Any) – Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster.
error_trace – Whether to include the stack trace of returned errors. Default is false.
filter_path – Used to reduce the response. This parameter takes a comma-separated list of filters. It supports using wildcards to match any field or part of a field’s name. You can also exclude fields with “-“.
flat_settings – If true, returns settings in flat format. Default is false.
human – Whether to return human readable values for statistics. Default is True.
pretty – Whether to pretty format the returned JSON response. Default is false.
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 each node to respond. If a node does not respond before its timeout expires, the response does not include its stats. However, timed out nodes are included in the response’s _nodes.failed property. Defaults to no timeout.
node_id –
params (Any) –
headers (Any) –
metric –
index_metric –
- Return type: