2023-10-26 13:34:34 -04:00
|
|
|
# -*- coding: utf-8 -*-
|
2021-08-06 12:59:39 +05:30
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
#
|
|
|
|
|
# The OpenSearch Contributors require contributions made to
|
|
|
|
|
# this file be licensed under the Apache-2.0 license or a
|
|
|
|
|
# compatible open source license.
|
|
|
|
|
#
|
|
|
|
|
# Modifications Copyright OpenSearch Contributors. See
|
|
|
|
|
# GitHub history for details.
|
|
|
|
|
#
|
2020-07-02 13:15:25 -05:00
|
|
|
# Licensed to Elasticsearch B.V. under one or more contributor
|
|
|
|
|
# license agreements. See the NOTICE file distributed with
|
|
|
|
|
# this work for additional information regarding copyright
|
|
|
|
|
# ownership. Elasticsearch B.V. licenses this file to you under
|
|
|
|
|
# the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
|
# not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
|
# under the License.
|
2020-04-23 11:22:08 -05:00
|
|
|
|
2022-10-04 00:15:18 +05:30
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
# ----------------------------------------------------
|
|
|
|
|
# THIS CODE IS GENERATED AND MANUAL EDITS WILL BE LOST.
|
|
|
|
|
#
|
|
|
|
|
# To contribute, kindly make essential modifications through either the "opensearch-py client generator":
|
|
|
|
|
# https://github.com/opensearch-project/opensearch-py/blob/main/utils/generate-api.py
|
|
|
|
|
# or the "OpenSearch API specification" available at:
|
|
|
|
|
# https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json
|
|
|
|
|
# -----------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
2023-11-06 13:08:19 -05:00
|
|
|
from typing import Any
|
|
|
|
|
|
2021-01-13 14:21:04 -06:00
|
|
|
from .utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params
|
2013-06-16 16:28:51 +02:00
|
|
|
|
2019-05-10 09:16:33 -06:00
|
|
|
|
2013-06-16 16:28:51 +02:00
|
|
|
class ClusterClient(NamespacedClient):
|
2019-05-10 09:16:33 -06:00
|
|
|
@query_params(
|
2023-10-09 14:57:09 -07:00
|
|
|
"awareness_attribute",
|
|
|
|
|
"cluster_manager_timeout",
|
2019-05-10 16:41:50 -06:00
|
|
|
"expand_wildcards",
|
2019-05-10 09:16:33 -06:00
|
|
|
"level",
|
|
|
|
|
"local",
|
|
|
|
|
"master_timeout",
|
|
|
|
|
"timeout",
|
|
|
|
|
"wait_for_active_shards",
|
|
|
|
|
"wait_for_events",
|
2019-05-10 16:41:50 -06:00
|
|
|
"wait_for_no_initializing_shards",
|
2019-05-10 09:16:33 -06:00
|
|
|
"wait_for_no_relocating_shards",
|
|
|
|
|
"wait_for_nodes",
|
|
|
|
|
"wait_for_status",
|
|
|
|
|
)
|
2023-11-06 13:08:19 -05:00
|
|
|
def health(
|
|
|
|
|
self,
|
|
|
|
|
index: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2013-06-16 16:28:51 +02:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Returns basic information about the health of the cluster.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2013-06-16 16:28:51 +02:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg index: Limit the information returned to specific indicies.
|
|
|
|
|
:arg awareness_attribute: The awareness attribute for which the
|
|
|
|
|
health is required.
|
|
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg expand_wildcards: Whether to expand wildcard expression to
|
2023-10-26 07:58:33 -07:00
|
|
|
concrete indices that are open, closed or both. Valid choices are all,
|
|
|
|
|
open, closed, hidden, none.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg level: Specify the level of detail for returned
|
2023-10-26 07:58:33 -07:00
|
|
|
information. Valid choices are cluster, indices, shards,
|
|
|
|
|
awareness_attributes.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg local: Return local information, do not retrieve the state
|
2023-10-26 07:58:33 -07:00
|
|
|
from cluster-manager node. Default is false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg timeout: Operation timeout.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg wait_for_active_shards: Wait until the specified number of
|
2023-10-09 14:57:09 -07:00
|
|
|
shards is active.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg wait_for_events: Wait until all currently queued events
|
2023-10-26 07:58:33 -07:00
|
|
|
with the given priority are processed. Valid choices are immediate,
|
|
|
|
|
urgent, high, normal, low, languid.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg wait_for_no_initializing_shards: Whether to wait until
|
2023-10-09 14:57:09 -07:00
|
|
|
there are no initializing shards in the cluster.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg wait_for_no_relocating_shards: Whether to wait until there
|
2023-10-09 14:57:09 -07:00
|
|
|
are no relocating shards in the cluster.
|
2015-08-25 01:21:16 +02:00
|
|
|
:arg wait_for_nodes: Wait until the specified number of nodes is
|
2023-10-09 14:57:09 -07:00
|
|
|
available.
|
|
|
|
|
:arg wait_for_status: Wait until cluster is in a specific state.
|
2023-10-26 07:58:33 -07:00
|
|
|
Valid choices are green, yellow, red.
|
2013-06-16 16:28:51 +02:00
|
|
|
"""
|
2019-05-10 09:16:33 -06:00
|
|
|
return self.transport.perform_request(
|
2020-03-11 16:33:15 -05:00
|
|
|
"GET",
|
|
|
|
|
_make_path("_cluster", "health", index),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
2013-07-18 16:36:38 +02:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
@query_params("cluster_manager_timeout", "local", "master_timeout")
|
2023-11-06 13:08:19 -05:00
|
|
|
def pending_tasks(
|
|
|
|
|
self,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2014-01-17 14:39:04 +01:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Returns a list of any cluster-level changes (e.g. create index, update mapping,
|
|
|
|
|
allocate or fail shard) which have not yet been executed.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2014-01-20 18:51:19 +01:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg local: Return local information, do not retrieve the state
|
2023-10-26 07:58:33 -07:00
|
|
|
from cluster-manager node. Default is false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2014-01-17 14:39:04 +01:00
|
|
|
"""
|
2019-05-10 09:16:33 -06:00
|
|
|
return self.transport.perform_request(
|
2020-03-11 16:33:15 -05:00
|
|
|
"GET", "/_cluster/pending_tasks", params=params, headers=headers
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@query_params(
|
|
|
|
|
"allow_no_indices",
|
2023-10-09 14:57:09 -07:00
|
|
|
"cluster_manager_timeout",
|
2019-05-10 09:16:33 -06:00
|
|
|
"expand_wildcards",
|
|
|
|
|
"flat_settings",
|
|
|
|
|
"ignore_unavailable",
|
|
|
|
|
"local",
|
|
|
|
|
"master_timeout",
|
2019-05-10 16:41:50 -06:00
|
|
|
"wait_for_metadata_version",
|
|
|
|
|
"wait_for_timeout",
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
2023-11-06 13:08:19 -05:00
|
|
|
def state(
|
|
|
|
|
self,
|
|
|
|
|
metric: Any = None,
|
|
|
|
|
index: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2013-07-24 16:39:48 +02:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Returns a comprehensive information about the state of the cluster.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2013-07-24 16:39:48 +02:00
|
|
|
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg metric: Limit the information returned to the specified
|
2023-10-26 07:58:33 -07:00
|
|
|
metrics. Valid choices are _all, blocks, metadata, nodes, routing_table,
|
|
|
|
|
routing_nodes, master_node, cluster_manager_node, version.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg index: Comma-separated list of indices; use `_all` or empty
|
|
|
|
|
string to perform the operation on all indices.
|
2015-01-23 03:47:01 +01:00
|
|
|
:arg allow_no_indices: Whether to ignore if a wildcard indices
|
|
|
|
|
expression resolves into no concrete indices. (This includes `_all`
|
2023-10-09 14:57:09 -07:00
|
|
|
string or when no indices have been specified).
|
|
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg expand_wildcards: Whether to expand wildcard expression to
|
2023-10-26 07:58:33 -07:00
|
|
|
concrete indices that are open, closed or both. Valid choices are all,
|
|
|
|
|
open, closed, hidden, none.
|
|
|
|
|
:arg flat_settings: Return settings in flat format. Default is
|
|
|
|
|
false.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg ignore_unavailable: Whether specified concrete indices
|
2023-10-09 14:57:09 -07:00
|
|
|
should be ignored when unavailable (missing or closed).
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg local: Return local information, do not retrieve the state
|
2023-10-26 07:58:33 -07:00
|
|
|
from cluster-manager node. Default is false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg wait_for_metadata_version: Wait for the metadata version to
|
2023-10-09 14:57:09 -07:00
|
|
|
be equal or greater than the specified metadata version.
|
2019-05-10 16:41:50 -06:00
|
|
|
:arg wait_for_timeout: The maximum time to wait for
|
2023-10-09 14:57:09 -07:00
|
|
|
wait_for_metadata_version before timing out.
|
2013-07-24 16:39:48 +02:00
|
|
|
"""
|
2020-03-10 12:08:03 -05:00
|
|
|
if index and metric in SKIP_IN_PATH:
|
|
|
|
|
metric = "_all"
|
|
|
|
|
|
2019-05-10 09:16:33 -06:00
|
|
|
return self.transport.perform_request(
|
2020-03-11 16:33:15 -05:00
|
|
|
"GET",
|
|
|
|
|
_make_path("_cluster", "state", metric, index),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
2013-07-24 16:39:48 +02:00
|
|
|
|
2019-05-10 09:16:33 -06:00
|
|
|
@query_params("flat_settings", "timeout")
|
2023-11-06 13:08:19 -05:00
|
|
|
def stats(
|
|
|
|
|
self,
|
|
|
|
|
node_id: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2014-01-17 15:20:44 +01:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Returns high-level overview of cluster statistics.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2014-01-17 15:20:44 +01:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg node_id: Comma-separated list of node IDs or names to limit
|
|
|
|
|
the returned information; use `_local` to return information from the
|
|
|
|
|
node you're connecting to, leave empty to get information from all
|
|
|
|
|
nodes.
|
2023-10-26 07:58:33 -07:00
|
|
|
:arg flat_settings: Return settings in flat format. Default is
|
|
|
|
|
false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg timeout: Operation timeout.
|
2014-01-17 15:20:44 +01:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
return self.transport.perform_request(
|
2019-12-17 23:23:56 +01:00
|
|
|
"GET",
|
|
|
|
|
"/_cluster/stats"
|
|
|
|
|
if node_id in SKIP_IN_PATH
|
|
|
|
|
else _make_path("_cluster", "stats", "nodes", node_id),
|
|
|
|
|
params=params,
|
2020-03-11 16:33:15 -05:00
|
|
|
headers=headers,
|
2019-12-17 22:31:35 +01:00
|
|
|
)
|
2013-07-24 16:39:48 +02:00
|
|
|
|
2019-05-10 09:16:33 -06:00
|
|
|
@query_params(
|
2023-10-09 14:57:09 -07:00
|
|
|
"cluster_manager_timeout",
|
2022-11-28 14:29:37 -08:00
|
|
|
"dry_run",
|
|
|
|
|
"explain",
|
|
|
|
|
"master_timeout",
|
|
|
|
|
"metric",
|
|
|
|
|
"retry_failed",
|
|
|
|
|
"timeout",
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
2023-11-06 13:08:19 -05:00
|
|
|
def reroute(
|
|
|
|
|
self,
|
|
|
|
|
body: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2013-07-18 16:36:38 +02:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Allows to manually change the allocation of individual shards in the cluster.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2019-12-17 22:31:35 +01:00
|
|
|
|
|
|
|
|
:arg body: The definition of `commands` to perform (`move`,
|
|
|
|
|
`cancel`, `allocate`)
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg dry_run: Simulate the operation only and return the
|
2023-10-09 14:57:09 -07:00
|
|
|
resulting state.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg explain: Return an explanation of why the commands can or
|
2023-10-09 14:57:09 -07:00
|
|
|
cannot be executed.
|
|
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg metric: Limit the information returned to the specified
|
2023-10-09 14:57:09 -07:00
|
|
|
metrics. Defaults to all but metadata.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg retry_failed: Retries allocation of shards that are blocked
|
2023-10-09 14:57:09 -07:00
|
|
|
due to too many subsequent allocation failures.
|
|
|
|
|
:arg timeout: Operation timeout.
|
2013-07-18 16:36:38 +02:00
|
|
|
"""
|
2019-05-10 09:16:33 -06:00
|
|
|
return self.transport.perform_request(
|
2020-03-11 16:33:15 -05:00
|
|
|
"POST", "/_cluster/reroute", params=params, headers=headers, body=body
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
2013-07-18 16:36:38 +02:00
|
|
|
|
2022-11-28 14:29:37 -08:00
|
|
|
@query_params(
|
2023-10-09 14:57:09 -07:00
|
|
|
"cluster_manager_timeout",
|
2022-11-28 14:29:37 -08:00
|
|
|
"flat_settings",
|
|
|
|
|
"include_defaults",
|
|
|
|
|
"master_timeout",
|
|
|
|
|
"timeout",
|
|
|
|
|
)
|
2023-11-06 13:08:19 -05:00
|
|
|
def get_settings(
|
|
|
|
|
self,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2013-07-18 16:47:05 +02:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Returns cluster settings.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2014-01-08 19:44:56 +01:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2023-10-26 07:58:33 -07:00
|
|
|
:arg flat_settings: Return settings in flat format. Default is
|
|
|
|
|
false.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg include_defaults: Whether to return all default clusters
|
2023-10-26 07:58:33 -07:00
|
|
|
setting. Default is false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg timeout: Operation timeout.
|
2013-07-18 16:47:05 +02:00
|
|
|
"""
|
2019-05-10 09:16:33 -06:00
|
|
|
return self.transport.perform_request(
|
2020-03-11 16:33:15 -05:00
|
|
|
"GET", "/_cluster/settings", params=params, headers=headers
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
2013-07-18 16:47:05 +02:00
|
|
|
|
2022-11-28 14:29:37 -08:00
|
|
|
@query_params(
|
2023-10-09 14:57:09 -07:00
|
|
|
"cluster_manager_timeout", "flat_settings", "master_timeout", "timeout"
|
2022-11-28 14:29:37 -08:00
|
|
|
)
|
2023-11-06 13:08:19 -05:00
|
|
|
def put_settings(
|
|
|
|
|
self,
|
|
|
|
|
body: Any,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2013-07-18 16:47:05 +02:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Updates the cluster settings.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2013-07-18 16:47:05 +02:00
|
|
|
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg body: The settings to be updated. Can be either `transient`
|
|
|
|
|
or `persistent` (survives cluster restart).
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2023-10-26 07:58:33 -07:00
|
|
|
:arg flat_settings: Return settings in flat format. Default is
|
|
|
|
|
false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg timeout: Operation timeout.
|
2013-07-18 16:47:05 +02:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
if body in SKIP_IN_PATH:
|
|
|
|
|
raise ValueError("Empty value passed for a required argument 'body'.")
|
|
|
|
|
|
2019-05-10 09:16:33 -06:00
|
|
|
return self.transport.perform_request(
|
2020-03-11 16:33:15 -05:00
|
|
|
"PUT", "/_cluster/settings", params=params, headers=headers, body=body
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
2013-07-18 16:47:05 +02:00
|
|
|
|
2019-05-10 16:41:50 -06:00
|
|
|
@query_params()
|
2023-11-06 13:08:19 -05:00
|
|
|
def remote_info(
|
|
|
|
|
self,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2019-05-10 16:41:50 -06:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Returns the information about configured remote clusters.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2019-05-10 16:41:50 -06:00
|
|
|
"""
|
2020-03-11 16:33:15 -05:00
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"GET", "/_remote/info", params=params, headers=headers
|
|
|
|
|
)
|
2019-05-10 16:41:50 -06:00
|
|
|
|
2019-05-10 09:16:33 -06:00
|
|
|
@query_params("include_disk_info", "include_yes_decisions")
|
2023-11-06 13:08:19 -05:00
|
|
|
def allocation_explain(
|
|
|
|
|
self,
|
|
|
|
|
body: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2016-05-17 14:12:39 +02:00
|
|
|
"""
|
2019-12-17 22:31:35 +01:00
|
|
|
Provides explanations for shard allocations in the cluster.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2016-05-17 14:12:39 +02:00
|
|
|
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg body: The index, shard, and primary flag to explain. Empty
|
|
|
|
|
means 'explain the first unassigned shard'
|
|
|
|
|
:arg include_disk_info: Return information about disk usage and
|
2023-10-26 07:58:33 -07:00
|
|
|
shard sizes. Default is false.
|
2019-12-17 22:31:35 +01:00
|
|
|
:arg include_yes_decisions: Return 'YES' decisions in
|
2023-10-26 07:58:33 -07:00
|
|
|
explanation. Default is false.
|
2016-05-17 14:12:39 +02:00
|
|
|
"""
|
2019-05-10 09:16:33 -06:00
|
|
|
return self.transport.perform_request(
|
2020-03-13 13:44:46 -05:00
|
|
|
"POST",
|
2020-03-11 16:33:15 -05:00
|
|
|
"/_cluster/allocation/explain",
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
body=body,
|
2019-05-10 09:16:33 -06:00
|
|
|
)
|
2020-04-01 09:16:38 -05:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
@query_params("cluster_manager_timeout", "master_timeout", "timeout")
|
2023-11-06 13:08:19 -05:00
|
|
|
def delete_component_template(
|
|
|
|
|
self,
|
|
|
|
|
name: Any,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-04-01 09:16:38 -05:00
|
|
|
"""
|
2023-10-09 14:57:09 -07:00
|
|
|
Deletes a component template.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-04-01 09:16:38 -05:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg name: The name of the template.
|
|
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
|
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg timeout: Operation timeout.
|
2020-04-01 09:16:38 -05:00
|
|
|
"""
|
|
|
|
|
if name in SKIP_IN_PATH:
|
|
|
|
|
raise ValueError("Empty value passed for a required argument 'name'.")
|
|
|
|
|
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"DELETE",
|
|
|
|
|
_make_path("_component_template", name),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
@query_params("cluster_manager_timeout", "local", "master_timeout")
|
2023-11-06 13:08:19 -05:00
|
|
|
def get_component_template(
|
|
|
|
|
self,
|
|
|
|
|
name: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-04-01 09:16:38 -05:00
|
|
|
"""
|
2023-10-09 14:57:09 -07:00
|
|
|
Returns one or more component templates.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-04-01 09:16:38 -05:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg name: The Comma-separated names of the component templates.
|
|
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2020-04-01 09:16:38 -05:00
|
|
|
:arg local: Return local information, do not retrieve the state
|
2023-10-26 07:58:33 -07:00
|
|
|
from cluster-manager node. Default is false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2020-04-01 09:16:38 -05:00
|
|
|
"""
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"GET",
|
|
|
|
|
_make_path("_component_template", name),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
@query_params("cluster_manager_timeout", "create", "master_timeout", "timeout")
|
2023-11-06 13:08:19 -05:00
|
|
|
def put_component_template(
|
|
|
|
|
self,
|
|
|
|
|
name: Any,
|
|
|
|
|
body: Any,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-04-01 09:16:38 -05:00
|
|
|
"""
|
2023-10-09 14:57:09 -07:00
|
|
|
Creates or updates a component template.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-04-01 09:16:38 -05:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg name: The name of the template.
|
2020-04-01 09:16:38 -05:00
|
|
|
:arg body: The template definition
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2020-04-01 09:16:38 -05:00
|
|
|
:arg create: Whether the index template should only be added if
|
2023-10-26 07:58:33 -07:00
|
|
|
new or can also replace an existing one. Default is false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg timeout: Operation timeout.
|
2020-04-01 09:16:38 -05:00
|
|
|
"""
|
|
|
|
|
for param in (name, body):
|
|
|
|
|
if param in SKIP_IN_PATH:
|
|
|
|
|
raise ValueError("Empty value passed for a required argument.")
|
|
|
|
|
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"PUT",
|
|
|
|
|
_make_path("_component_template", name),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
body=body,
|
|
|
|
|
)
|
2020-04-23 11:20:33 -05:00
|
|
|
|
2023-10-26 07:58:33 -07:00
|
|
|
@query_params("cluster_manager_timeout", "local", "master_timeout")
|
2023-11-06 13:08:19 -05:00
|
|
|
def exists_component_template(
|
|
|
|
|
self,
|
|
|
|
|
name: Any,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-04-23 11:20:33 -05:00
|
|
|
"""
|
2023-10-09 14:57:09 -07:00
|
|
|
Returns information about whether a particular component template exist.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-04-23 11:20:33 -05:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg name: The name of the template.
|
2023-10-26 07:58:33 -07:00
|
|
|
:arg cluster_manager_timeout: Operation timeout for connection
|
|
|
|
|
to cluster-manager node.
|
2020-04-23 11:20:33 -05:00
|
|
|
:arg local: Return local information, do not retrieve the state
|
2023-10-26 07:58:33 -07:00
|
|
|
from cluster-manager node. Default is false.
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg master_timeout (Deprecated: To promote inclusive language,
|
2023-10-26 07:58:33 -07:00
|
|
|
use 'cluster_manager_timeout' instead.): Operation timeout for
|
|
|
|
|
connection to master node.
|
2020-04-23 11:20:33 -05:00
|
|
|
"""
|
|
|
|
|
if name in SKIP_IN_PATH:
|
|
|
|
|
raise ValueError("Empty value passed for a required argument 'name'.")
|
|
|
|
|
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"HEAD",
|
|
|
|
|
_make_path("_component_template", name),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
2020-05-08 16:07:52 -05:00
|
|
|
|
|
|
|
|
@query_params("wait_for_removal")
|
2023-11-06 13:08:19 -05:00
|
|
|
def delete_voting_config_exclusions(
|
|
|
|
|
self,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-05-08 16:07:52 -05:00
|
|
|
"""
|
|
|
|
|
Clears cluster voting config exclusions.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-05-08 16:07:52 -05:00
|
|
|
|
|
|
|
|
:arg wait_for_removal: Specifies whether to wait for all
|
|
|
|
|
excluded nodes to be removed from the cluster before clearing the voting
|
2023-10-26 07:58:33 -07:00
|
|
|
configuration exclusions list. Default is True.
|
2020-05-08 16:07:52 -05:00
|
|
|
"""
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"DELETE",
|
|
|
|
|
"/_cluster/voting_config_exclusions",
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@query_params("node_ids", "node_names", "timeout")
|
2023-11-06 13:08:19 -05:00
|
|
|
def post_voting_config_exclusions(
|
|
|
|
|
self,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-05-08 16:07:52 -05:00
|
|
|
"""
|
|
|
|
|
Updates the cluster voting config exclusions by node ids or node names.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-05-08 16:07:52 -05:00
|
|
|
|
2023-10-09 14:57:09 -07:00
|
|
|
:arg node_ids: Comma-separated list of the persistent ids of the
|
2020-05-08 16:07:52 -05:00
|
|
|
nodes to exclude from the voting configuration. If specified, you may
|
2023-10-09 14:57:09 -07:00
|
|
|
not also specify ?node_names.
|
|
|
|
|
:arg node_names: Comma-separated list of the names of the nodes
|
|
|
|
|
to exclude from the voting configuration. If specified, you may not also
|
|
|
|
|
specify ?node_ids.
|
|
|
|
|
:arg timeout: Operation timeout.
|
2020-05-08 16:07:52 -05:00
|
|
|
"""
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"POST", "/_cluster/voting_config_exclusions", params=params, headers=headers
|
|
|
|
|
)
|
2023-10-09 14:57:09 -07:00
|
|
|
|
|
|
|
|
@query_params()
|
2023-11-06 13:08:19 -05:00
|
|
|
def delete_decommission_awareness(
|
|
|
|
|
self,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2023-10-09 14:57:09 -07:00
|
|
|
"""
|
|
|
|
|
Delete any existing decommission.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"DELETE",
|
|
|
|
|
"/_cluster/decommission/awareness/",
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@query_params()
|
2023-11-06 13:08:19 -05:00
|
|
|
def delete_weighted_routing(
|
|
|
|
|
self,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2023-10-09 14:57:09 -07:00
|
|
|
"""
|
|
|
|
|
Delete weighted shard routing weights.
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"DELETE",
|
|
|
|
|
"/_cluster/routing/awareness/weights",
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@query_params()
|
|
|
|
|
def get_decommission_awareness(
|
2023-11-06 13:08:19 -05:00
|
|
|
self,
|
|
|
|
|
awareness_attribute_name: Any,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2023-10-09 14:57:09 -07:00
|
|
|
"""
|
|
|
|
|
Get details and status of decommissioned attribute.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:arg awareness_attribute_name: Awareness attribute name.
|
|
|
|
|
"""
|
|
|
|
|
if awareness_attribute_name in SKIP_IN_PATH:
|
|
|
|
|
raise ValueError(
|
|
|
|
|
"Empty value passed for a required argument 'awareness_attribute_name'."
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"GET",
|
|
|
|
|
_make_path(
|
|
|
|
|
"_cluster",
|
|
|
|
|
"decommission",
|
|
|
|
|
"awareness",
|
|
|
|
|
awareness_attribute_name,
|
|
|
|
|
"_status",
|
|
|
|
|
),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@query_params()
|
2023-11-06 13:08:19 -05:00
|
|
|
def get_weighted_routing(
|
|
|
|
|
self,
|
|
|
|
|
attribute: Any,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2023-10-09 14:57:09 -07:00
|
|
|
"""
|
|
|
|
|
Fetches weighted shard routing weights.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:arg attribute: Awareness attribute name.
|
|
|
|
|
"""
|
|
|
|
|
if attribute in SKIP_IN_PATH:
|
|
|
|
|
raise ValueError("Empty value passed for a required argument 'attribute'.")
|
|
|
|
|
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"GET",
|
|
|
|
|
_make_path("_cluster", "routing", "awareness", attribute, "weights"),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@query_params()
|
|
|
|
|
def put_decommission_awareness(
|
|
|
|
|
self,
|
2023-11-06 13:08:19 -05:00
|
|
|
awareness_attribute_name: Any,
|
|
|
|
|
awareness_attribute_value: Any,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2023-10-09 14:57:09 -07:00
|
|
|
"""
|
|
|
|
|
Decommissions an awareness attribute.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:arg awareness_attribute_name: Awareness attribute name.
|
|
|
|
|
:arg awareness_attribute_value: Awareness attribute value.
|
|
|
|
|
"""
|
|
|
|
|
for param in (awareness_attribute_name, awareness_attribute_value):
|
|
|
|
|
if param in SKIP_IN_PATH:
|
|
|
|
|
raise ValueError("Empty value passed for a required argument.")
|
|
|
|
|
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"PUT",
|
|
|
|
|
_make_path(
|
|
|
|
|
"_cluster",
|
|
|
|
|
"decommission",
|
|
|
|
|
"awareness",
|
|
|
|
|
awareness_attribute_name,
|
|
|
|
|
awareness_attribute_value,
|
|
|
|
|
),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@query_params()
|
2023-11-06 13:08:19 -05:00
|
|
|
def put_weighted_routing(
|
|
|
|
|
self,
|
|
|
|
|
attribute: Any,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2023-10-09 14:57:09 -07:00
|
|
|
"""
|
|
|
|
|
Updates weighted shard routing weights.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:arg attribute: Awareness attribute name.
|
|
|
|
|
"""
|
|
|
|
|
if attribute in SKIP_IN_PATH:
|
|
|
|
|
raise ValueError("Empty value passed for a required argument 'attribute'.")
|
|
|
|
|
|
|
|
|
|
return self.transport.perform_request(
|
|
|
|
|
"PUT",
|
|
|
|
|
_make_path("_cluster", "routing", "awareness", attribute, "weights"),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|