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-05-15 09:36:47 -05:00
|
|
|
|
2022-10-04 00:15:18 +05:30
|
|
|
|
2023-11-21 13:04:39 -05:00
|
|
|
# ------------------------------------------------------------------------------------------
|
|
|
|
|
# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST
|
2023-10-03 15:00:49 -07:00
|
|
|
#
|
2023-11-21 13:04:39 -05:00
|
|
|
# To contribute, kindly make modifications in the opensearch-py client generator
|
|
|
|
|
# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md
|
|
|
|
|
# and https://github.com/opensearch-project/opensearch-api-specification for details.
|
|
|
|
|
# -----------------------------------------------------------------------------------------+
|
2023-10-03 15:00:49 -07:00
|
|
|
|
|
|
|
|
|
2023-11-06 13:08:19 -05:00
|
|
|
from typing import Any
|
|
|
|
|
|
2021-01-13 14:21:04 -06:00
|
|
|
from .utils import NamespacedClient, _make_path, query_params
|
2020-05-15 09:36:47 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class NodesClient(NamespacedClient):
|
2024-04-17 16:22:14 -07:00
|
|
|
@query_params("error_trace", "filter_path", "human", "pretty", "source", "timeout")
|
2020-05-20 12:34:29 -05:00
|
|
|
async def reload_secure_settings(
|
2023-11-06 13:08:19 -05:00
|
|
|
self,
|
|
|
|
|
body: Any = None,
|
|
|
|
|
node_id: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-05-15 09:36:47 -05:00
|
|
|
"""
|
|
|
|
|
Reloads secure settings.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-05-15 09:36:47 -05:00
|
|
|
|
2023-10-03 15:00:49 -07:00
|
|
|
:arg body: An object containing the password for the opensearch
|
|
|
|
|
keystore
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg node_id: The names of particular nodes in the cluster to
|
|
|
|
|
target.
|
|
|
|
|
:arg error_trace: Whether to include the stack trace of returned
|
|
|
|
|
errors.
|
|
|
|
|
:arg filter_path: Comma-separated list of filters used to reduce
|
|
|
|
|
the response.
|
|
|
|
|
:arg human: Whether to return human readable values for
|
|
|
|
|
statistics.
|
|
|
|
|
:arg pretty: Whether to pretty format the returned JSON
|
|
|
|
|
response.
|
|
|
|
|
:arg source: The URL-encoded request definition. Useful for
|
|
|
|
|
libraries that do not accept a request body for non-POST requests.
|
2024-08-14 18:25:01 -04:00
|
|
|
:arg timeout: Period to wait for a response. If no response is
|
2024-04-17 16:22:14 -07:00
|
|
|
received before the timeout expires, the request fails and returns an
|
|
|
|
|
error.
|
2020-05-15 09:36:47 -05:00
|
|
|
"""
|
2020-05-20 12:34:29 -05:00
|
|
|
return await self.transport.perform_request(
|
2020-05-15 09:36:47 -05:00
|
|
|
"POST",
|
|
|
|
|
_make_path("_nodes", node_id, "reload_secure_settings"),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
body=body,
|
|
|
|
|
)
|
|
|
|
|
|
2024-04-17 16:22:14 -07:00
|
|
|
@query_params(
|
|
|
|
|
"error_trace",
|
|
|
|
|
"filter_path",
|
|
|
|
|
"flat_settings",
|
|
|
|
|
"human",
|
|
|
|
|
"pretty",
|
|
|
|
|
"source",
|
|
|
|
|
"timeout",
|
|
|
|
|
)
|
2023-11-06 13:08:19 -05:00
|
|
|
async def info(
|
|
|
|
|
self,
|
|
|
|
|
node_id: Any = None,
|
|
|
|
|
metric: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-05-15 09:36:47 -05:00
|
|
|
"""
|
|
|
|
|
Returns information about nodes in the cluster.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-05-15 09:36:47 -05:00
|
|
|
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg node_id: Comma-separated list of node IDs or names used to
|
|
|
|
|
limit returned information.
|
|
|
|
|
:arg metric: Limits the information returned to the specific
|
|
|
|
|
metrics. Supports a comma-separated list, such as http,ingest.
|
|
|
|
|
:arg error_trace: Whether to include the stack trace of returned
|
|
|
|
|
errors.
|
|
|
|
|
:arg filter_path: Comma-separated list of filters used to reduce
|
|
|
|
|
the response.
|
|
|
|
|
:arg flat_settings: If true, returns settings in flat format.
|
2024-04-22 08:52:16 -04:00
|
|
|
Default is false.
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg human: Whether to return human readable values for
|
|
|
|
|
statistics.
|
|
|
|
|
:arg pretty: Whether to pretty format the returned JSON
|
|
|
|
|
response.
|
|
|
|
|
:arg source: The URL-encoded request definition. Useful for
|
|
|
|
|
libraries that do not accept a request body for non-POST requests.
|
|
|
|
|
:arg timeout: Period to wait for a response. If no response is
|
|
|
|
|
received before the timeout expires, the request fails and returns an
|
|
|
|
|
error.
|
2020-05-15 09:36:47 -05:00
|
|
|
"""
|
2020-05-20 12:34:29 -05:00
|
|
|
return await self.transport.perform_request(
|
2020-05-15 09:36:47 -05:00
|
|
|
"GET", _make_path("_nodes", node_id, metric), params=params, headers=headers
|
|
|
|
|
)
|
|
|
|
|
|
2020-05-20 12:34:29 -05:00
|
|
|
@query_params(
|
|
|
|
|
"completion_fields",
|
2024-04-17 16:22:14 -07:00
|
|
|
"error_trace",
|
2020-05-20 12:34:29 -05:00
|
|
|
"fielddata_fields",
|
|
|
|
|
"fields",
|
2024-04-17 16:22:14 -07:00
|
|
|
"filter_path",
|
2020-05-20 12:34:29 -05:00
|
|
|
"groups",
|
2024-04-17 16:22:14 -07:00
|
|
|
"human",
|
2020-05-20 12:34:29 -05:00
|
|
|
"include_segment_file_sizes",
|
|
|
|
|
"level",
|
2024-04-17 16:22:14 -07:00
|
|
|
"pretty",
|
|
|
|
|
"source",
|
2020-05-20 12:34:29 -05:00
|
|
|
"timeout",
|
|
|
|
|
"types",
|
|
|
|
|
)
|
|
|
|
|
async def stats(
|
2023-11-06 13:08:19 -05:00
|
|
|
self,
|
|
|
|
|
node_id: Any = None,
|
|
|
|
|
metric: Any = None,
|
|
|
|
|
index_metric: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-05-20 12:34:29 -05:00
|
|
|
"""
|
|
|
|
|
Returns statistical information about nodes in the cluster.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-05-20 12:34:29 -05:00
|
|
|
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg node_id: Comma-separated list of node IDs or names used to
|
|
|
|
|
limit returned information.
|
2020-05-20 12:34:29 -05:00
|
|
|
:arg metric: Limit the information returned to the specified
|
2024-04-17 16:22:14 -07:00
|
|
|
metrics
|
|
|
|
|
:arg index_metric: Limit the information returned for indices
|
|
|
|
|
metric to the specific index metrics. It can be used only if indices (or
|
|
|
|
|
all) metric is specified.
|
|
|
|
|
:arg completion_fields: Comma-separated list or wildcard
|
|
|
|
|
expressions of fields to include in fielddata and suggest statistics.
|
|
|
|
|
:arg error_trace: Whether to include the stack trace of returned
|
|
|
|
|
errors.
|
|
|
|
|
:arg fielddata_fields: Comma-separated list or wildcard
|
|
|
|
|
expressions of fields to include in fielddata statistics.
|
|
|
|
|
:arg fields: Comma-separated list or wildcard expressions of
|
|
|
|
|
fields to include in the statistics.
|
|
|
|
|
:arg filter_path: Comma-separated list of filters used to reduce
|
|
|
|
|
the response.
|
|
|
|
|
:arg groups: Comma-separated list of search groups to include in
|
|
|
|
|
the search statistics.
|
|
|
|
|
:arg human: Whether to return human readable values for
|
|
|
|
|
statistics.
|
|
|
|
|
:arg include_segment_file_sizes: If true, the call reports the
|
2020-05-20 12:34:29 -05:00
|
|
|
aggregated disk usage of each one of the Lucene index files (only
|
2024-04-22 08:52:16 -04:00
|
|
|
applies if segment stats are requested). Default is false.
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg level: Indicates whether statistics are aggregated at the
|
|
|
|
|
cluster, index, or shard level. Valid choices are cluster, indices,
|
|
|
|
|
shards.
|
|
|
|
|
:arg pretty: Whether to pretty format the returned JSON
|
|
|
|
|
response.
|
|
|
|
|
:arg source: The URL-encoded request definition. Useful for
|
|
|
|
|
libraries that do not accept a request body for non-POST requests.
|
|
|
|
|
:arg timeout: Period to wait for a response. If no response is
|
|
|
|
|
received before the timeout expires, the request fails and returns an
|
|
|
|
|
error.
|
|
|
|
|
:arg types: A comma-separated list of document types for the
|
|
|
|
|
indexing index metric.
|
2020-05-20 12:34:29 -05:00
|
|
|
"""
|
|
|
|
|
return await self.transport.perform_request(
|
|
|
|
|
"GET",
|
|
|
|
|
_make_path("_nodes", node_id, "stats", metric, index_metric),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
2020-05-15 09:36:47 -05:00
|
|
|
@query_params(
|
2024-04-17 16:22:14 -07:00
|
|
|
"doc_type",
|
|
|
|
|
"error_trace",
|
|
|
|
|
"filter_path",
|
|
|
|
|
"human",
|
|
|
|
|
"ignore_idle_threads",
|
|
|
|
|
"interval",
|
|
|
|
|
"pretty",
|
|
|
|
|
"snapshots",
|
|
|
|
|
"source",
|
|
|
|
|
"threads",
|
|
|
|
|
"timeout",
|
2020-05-15 09:36:47 -05:00
|
|
|
)
|
2023-11-06 13:08:19 -05:00
|
|
|
async def hot_threads(
|
|
|
|
|
self,
|
|
|
|
|
node_id: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-05-15 09:36:47 -05:00
|
|
|
"""
|
|
|
|
|
Returns information about hot threads on each node in the cluster.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-05-15 09:36:47 -05:00
|
|
|
|
2023-10-03 15:00:49 -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.
|
2024-07-15 08:30:16 -04:00
|
|
|
:arg doc_type: The type to sample. Valid choices are block, cpu,
|
|
|
|
|
wait.
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg error_trace: Whether to include the stack trace of returned
|
|
|
|
|
errors.
|
|
|
|
|
:arg filter_path: Comma-separated list of filters used to reduce
|
|
|
|
|
the response.
|
|
|
|
|
:arg human: Whether to return human readable values for
|
|
|
|
|
statistics.
|
2020-05-15 09:36:47 -05:00
|
|
|
:arg ignore_idle_threads: Don't show threads that are in known-
|
|
|
|
|
idle places, such as waiting on a socket select or pulling from an empty
|
2023-10-26 07:58:33 -07:00
|
|
|
task queue. Default is True.
|
2023-10-03 15:00:49 -07:00
|
|
|
:arg interval: The interval for the second sampling of threads.
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg pretty: Whether to pretty format the returned JSON
|
|
|
|
|
response.
|
2023-10-26 07:58:33 -07:00
|
|
|
:arg snapshots: Number of samples of thread stacktrace. Default
|
|
|
|
|
is 10.
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg source: The URL-encoded request definition. Useful for
|
|
|
|
|
libraries that do not accept a request body for non-POST requests.
|
2020-05-15 09:36:47 -05:00
|
|
|
:arg threads: Specify the number of threads to provide
|
2023-10-26 07:58:33 -07:00
|
|
|
information for. Default is 3.
|
2023-10-03 15:00:49 -07:00
|
|
|
:arg timeout: Operation timeout.
|
2020-05-15 09:36:47 -05:00
|
|
|
"""
|
|
|
|
|
# type is a reserved word so it cannot be used, use doc_type instead
|
|
|
|
|
if "doc_type" in params:
|
|
|
|
|
params["type"] = params.pop("doc_type")
|
|
|
|
|
|
2020-05-20 12:34:29 -05:00
|
|
|
return await self.transport.perform_request(
|
2020-05-15 09:36:47 -05:00
|
|
|
"GET",
|
|
|
|
|
_make_path("_nodes", node_id, "hot_threads"),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|
|
|
|
|
|
2024-04-17 16:22:14 -07:00
|
|
|
@query_params("error_trace", "filter_path", "human", "pretty", "source", "timeout")
|
2023-11-06 13:08:19 -05:00
|
|
|
async def usage(
|
|
|
|
|
self,
|
|
|
|
|
node_id: Any = None,
|
|
|
|
|
metric: Any = None,
|
|
|
|
|
params: Any = None,
|
|
|
|
|
headers: Any = None,
|
|
|
|
|
) -> Any:
|
2020-05-15 09:36:47 -05:00
|
|
|
"""
|
|
|
|
|
Returns low-level information about REST actions usage on nodes.
|
2020-10-20 13:02:15 -05:00
|
|
|
|
2020-05-15 09:36:47 -05:00
|
|
|
|
2024-04-17 16:22:14 -07:00
|
|
|
:arg node_id: A comma-separated list of node IDs or names to
|
|
|
|
|
limit the returned information; use `_local` to return information from
|
|
|
|
|
the node you're connecting to, leave empty to get information from all
|
|
|
|
|
nodes
|
|
|
|
|
:arg metric: Limits the information returned to the specific
|
|
|
|
|
metrics. A comma-separated list of the following options: `_all`,
|
|
|
|
|
`rest_actions`.
|
|
|
|
|
:arg error_trace: Whether to include the stack trace of returned
|
|
|
|
|
errors.
|
|
|
|
|
:arg filter_path: Comma-separated list of filters used to reduce
|
|
|
|
|
the response.
|
|
|
|
|
:arg human: Whether to return human readable values for
|
|
|
|
|
statistics.
|
|
|
|
|
:arg pretty: Whether to pretty format the returned JSON
|
|
|
|
|
response.
|
|
|
|
|
:arg source: The URL-encoded request definition. Useful for
|
|
|
|
|
libraries that do not accept a request body for non-POST requests.
|
2024-08-14 18:25:01 -04:00
|
|
|
:arg timeout: Period to wait for a response. If no response is
|
2024-04-17 16:22:14 -07:00
|
|
|
received before the timeout expires, the request fails and returns an
|
|
|
|
|
error.
|
2020-05-15 09:36:47 -05:00
|
|
|
"""
|
2020-05-20 12:34:29 -05:00
|
|
|
return await self.transport.perform_request(
|
2020-05-15 09:36:47 -05:00
|
|
|
"GET",
|
|
|
|
|
_make_path("_nodes", node_id, "usage", metric),
|
|
|
|
|
params=params,
|
|
|
|
|
headers=headers,
|
|
|
|
|
)
|