Files
opensearch-pyd/opensearchpy/client/cat.py
T

765 lines
29 KiB
Python
Raw Normal View History

# 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.
#
# 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
from .utils import NamespacedClient, _make_path, query_params
2014-01-18 01:30:31 +01:00
2019-05-10 09:16:33 -06:00
2014-01-18 01:30:31 +01:00
class CatClient(NamespacedClient):
2020-04-01 09:16:38 -05:00
@query_params("expand_wildcards", "format", "h", "help", "local", "s", "v")
2020-03-11 16:33:15 -05:00
def aliases(self, name=None, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Shows information about currently configured aliases to indices including
filter and routing infos.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
:arg name: A comma-separated list of alias names to return
2020-04-01 09:16:38 -05:00
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
2020-04-03 12:52:11 -05:00
closed, hidden, none, all Default: all
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01: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("_cat", "aliases", name), params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2014-04-28 19:19:02 +02:00
2022-11-28 14:29:37 -08:00
@query_params(
"bytes",
"format",
"h",
"help",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"v",
)
2020-03-11 16:33:15 -05:00
def allocation(self, node_id=None, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Provides a snapshot of how many shards are allocated to each data node and how
much disk space they are using.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg node_id: A comma-separated list of node IDs or names to
limit the returned information
:arg bytes: The unit in which to display byte values Valid
2019-12-17 22:31:35 +01:00
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01: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("_cat", "allocation", node_id),
params=params,
headers=headers,
2019-05-10 09:16:33 -06:00
)
2014-04-28 19:19:02 +02:00
2019-12-17 22:31:35 +01:00
@query_params("format", "h", "help", "s", "v")
2020-03-11 16:33:15 -05:00
def count(self, index=None, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Provides quick access to the document count of the entire cluster, or
individual indices.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg index: A comma-separated list of index names to limit the
returned information
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01: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("_cat", "count", index), params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2014-04-28 19:19:02 +02:00
2019-12-17 22:31:35 +01:00
@query_params("format", "h", "help", "s", "time", "ts", "v")
2020-03-11 16:33:15 -05:00
def health(self, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns a concise representation of the cluster health.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
2020-04-03 12:52:11 -05:00
choices: d, h, m, s, ms, micros, nanos
2019-12-17 22:31:35 +01:00
:arg ts: Set to false to disable timestamping Default: True
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01:00
"""
2020-03-11 16:33:15 -05:00
return self.transport.perform_request(
"GET", "/_cat/health", params=params, headers=headers
)
2014-04-28 19:19:02 +02:00
2019-05-10 09:16:33 -06:00
@query_params("help", "s")
2020-03-11 16:33:15 -05:00
def help(self, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns help for the Cat APIs.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg s: Comma-separated list of column names or column aliases
to sort by
2014-01-18 01:30:31 +01:00
"""
2020-03-11 16:33:15 -05:00
return self.transport.perform_request(
"GET", "/_cat", params=params, headers=headers
)
2014-04-28 19:19:02 +02:00
2019-05-10 09:16:33 -06:00
@query_params(
"bytes",
2020-04-01 09:16:38 -05:00
"expand_wildcards",
2019-05-10 09:16:33 -06:00
"format",
"h",
"health",
"help",
2019-12-17 22:31:35 +01:00
"include_unloaded_segments",
2019-05-10 09:16:33 -06:00
"local",
"master_timeout",
2022-11-28 14:29:37 -08:00
"cluster_manager_timeout",
2019-05-10 09:16:33 -06:00
"pri",
"s",
2019-12-17 22:31:35 +01:00
"time",
2019-05-10 09:16:33 -06:00
"v",
)
2020-03-11 16:33:15 -05:00
def indices(self, index=None, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns information about indices: number of primaries and replicas, document
counts, disk size, ...
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg index: A comma-separated list of index names to limit the
returned information
:arg bytes: The unit in which to display byte values Valid
2020-03-13 13:44:46 -05:00
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
2020-04-01 09:16:38 -05:00
:arg expand_wildcards: Whether to expand wildcard expression to
concrete indices that are open, closed or both. Valid choices: open,
closed, hidden, none, all Default: all
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg health: A health status ("green", "yellow", or "red" to
filter only indices matching the specified health status Valid choices:
2019-12-17 22:31:35 +01:00
green, yellow, red
:arg help: Return help information
:arg include_unloaded_segments: If set to true segment stats
will include stats for segments that are not currently loaded into
memory
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg pri: Set to true to return stats only for primary shards
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
2020-04-01 09:16:38 -05:00
choices: d, h, m, s, ms, micros, nanos
2019-12-17 22:31:35 +01:00
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01: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("_cat", "indices", index), params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2014-04-28 19:19:02 +02:00
2022-11-28 14:29:37 -08:00
@query_params(
"format",
"h",
"help",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"v",
)
2020-03-11 16:33:15 -05:00
def master(self, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns information about the master node.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
"""
from warnings import warn
warn("Deprecated: use `cluster_manager` instead")
return self.transport.perform_request(
"GET", "/_cat/master", params=params, headers=headers
)
@query_params("format", "h", "help", "local", "cluster_manager_timeout", "s", "v")
def cluster_manager(self, params=None, headers=None):
"""
Returns information about the cluster_manager node.
:arg format: a short version of the Accept header, e.g. json,
yaml
:arg h: Comma-separated list of column names to display
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
from cluster_manager node (default: false)
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01:00
"""
2020-03-11 16:33:15 -05:00
return self.transport.perform_request(
2022-11-28 14:29:37 -08:00
"GET", "/_cat/cluster_manager", params=params, headers=headers
2020-03-11 16:33:15 -05:00
)
2014-04-28 19:19:02 +02:00
2019-12-17 22:31:35 +01:00
@query_params(
"bytes",
"format",
"full_id",
"h",
"help",
2021-03-23 15:12:20 -05:00
"include_unloaded_segments",
2019-12-17 22:31:35 +01:00
"local",
"master_timeout",
2022-11-28 14:29:37 -08:00
"cluster_manager_timeout",
2019-12-17 22:31:35 +01:00
"s",
"time",
"v",
)
2020-03-11 16:33:15 -05:00
def nodes(self, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns basic statistics about performance of cluster nodes.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
:arg bytes: The unit in which to display byte values Valid
2019-12-17 22:31:35 +01:00
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
:arg format: a short version of the Accept header, e.g. json,
yaml
:arg full_id: Return the full node ID instead of the shortened
version (default: false)
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
2021-03-23 15:12:20 -05:00
:arg include_unloaded_segments: If set to true segment stats
will include stats for segments that are not currently loaded into
memory
2020-03-13 13:44:46 -05:00
:arg local: Calculate the selected nodes using the local cluster
state rather than the state from master node (default: false)
2022-11-28 14:29:37 -08:00
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
2020-04-01 09:16:38 -05:00
choices: d, h, m, s, ms, micros, nanos
2019-12-17 22:31:35 +01:00
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01:00
"""
2020-03-11 16:33:15 -05:00
return self.transport.perform_request(
"GET", "/_cat/nodes", params=params, headers=headers
)
2014-04-28 19:19:02 +02:00
2019-05-10 09:16:33 -06:00
@query_params(
2019-12-17 23:23:56 +01:00
"active_only", "bytes", "detailed", "format", "h", "help", "s", "time", "v"
2019-05-10 09:16:33 -06:00
)
2020-03-11 16:33:15 -05:00
def recovery(self, index=None, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns information about index shard recoveries, both on-going completed.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg index: Comma-separated list or wildcard expression of index
names to limit the returned information
:arg active_only: If `true`, the response only includes ongoing
shard recoveries
:arg bytes: The unit in which to display byte values Valid
2019-12-17 22:31:35 +01:00
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
:arg detailed: If `true`, the response includes detailed
information about shard recoveries
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
2020-04-01 09:16:38 -05:00
choices: d, h, m, s, ms, micros, nanos
2019-12-17 22:31:35 +01:00
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01: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("_cat", "recovery", index), params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2014-04-28 19:19:02 +02:00
2019-05-10 09:16:33 -06:00
@query_params(
2022-11-28 14:29:37 -08:00
"bytes",
"format",
"h",
"help",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"time",
"v",
2019-05-10 09:16:33 -06:00
)
2020-03-11 16:33:15 -05:00
def shards(self, index=None, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Provides a detailed view of shard allocation on nodes.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg index: A comma-separated list of index names to limit the
returned information
:arg bytes: The unit in which to display byte values Valid
2019-12-17 22:31:35 +01:00
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
2020-04-01 09:16:38 -05:00
choices: d, h, m, s, ms, micros, nanos
2019-12-17 22:31:35 +01:00
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01: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("_cat", "shards", index), params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2014-04-23 17:39:25 +02:00
2019-12-17 22:31:35 +01:00
@query_params("bytes", "format", "h", "help", "s", "v")
2020-03-11 16:33:15 -05:00
def segments(self, index=None, params=None, headers=None):
2014-04-23 17:39:25 +02:00
"""
2019-12-17 22:31:35 +01:00
Provides low-level information about the segments in the shards of an index.
2020-10-20 13:02:15 -05:00
2014-04-23 17:39:25 +02:00
2019-12-17 22:31:35 +01:00
:arg index: A comma-separated list of index names to limit the
returned information
:arg bytes: The unit in which to display byte values Valid
2019-12-17 22:31:35 +01:00
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-04-23 17:39:25 +02:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2014-04-23 17:39:25 +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("_cat", "segments", index), params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2014-04-28 19:19:02 +02:00
2022-11-28 14:29:37 -08:00
@query_params(
"format",
"h",
"help",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"time",
"v",
)
2020-03-11 16:33:15 -05:00
def pending_tasks(self, params=None, headers=None):
2014-01-18 01:30:31 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns a concise representation of the cluster pending tasks.
2020-10-20 13:02:15 -05:00
2014-01-18 01:30:31 +01:00
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
2020-04-01 09:16:38 -05:00
choices: d, h, m, s, ms, micros, nanos
2019-12-17 22:31:35 +01:00
:arg v: Verbose mode. Display column headers
2014-01-18 01:30:31 +01:00
"""
2019-05-10 09:16:33 -06:00
return self.transport.perform_request(
2020-03-11 16:33:15 -05:00
"GET", "/_cat/pending_tasks", params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2014-04-28 19:19:02 +02:00
2022-11-28 14:29:37 -08:00
@query_params(
"format",
"h",
"help",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"size",
"v",
)
2020-03-11 16:33:15 -05:00
def thread_pool(self, thread_pool_patterns=None, params=None, headers=None):
2014-02-10 18:14:30 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns cluster-wide thread pool statistics per node. By default the active,
queue and rejected statistics are returned for all thread pools.
2020-10-20 13:02:15 -05:00
2014-02-10 18:14:30 +01:00
2019-12-17 22:31:35 +01:00
:arg thread_pool_patterns: A comma-separated list of regular-
expressions to filter the thread pools in the output
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-02-10 18:14:30 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg size: The multiplier in which to display values Valid
2019-12-17 22:31:35 +01:00
choices: , k, m, g, t, p
:arg v: Verbose mode. Display column headers
2014-02-10 18:14:30 +01:00
"""
2019-05-10 09:16:33 -06:00
return self.transport.perform_request(
"GET",
_make_path("_cat", "thread_pool", thread_pool_patterns),
params=params,
2020-03-11 16:33:15 -05:00
headers=headers,
2019-05-10 09:16:33 -06:00
)
2014-05-09 17:41:59 +02:00
2019-12-17 23:23:56 +01:00
@query_params("bytes", "format", "h", "help", "s", "v")
2020-03-11 16:33:15 -05:00
def fielddata(self, fields=None, params=None, headers=None):
2014-05-09 17:41:59 +02:00
"""
2019-12-17 22:31:35 +01:00
Shows how much heap memory is currently being used by fielddata on every data
node in the cluster.
2020-10-20 13:02:15 -05:00
2014-05-09 17:41:59 +02:00
2019-12-17 22:31:35 +01:00
:arg fields: A comma-separated list of fields to return in the
output
2020-03-20 14:21:11 +01:00
:arg bytes: The unit in which to display byte values Valid
choices: b, k, kb, m, mb, g, gb, t, tb, p, pb
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2014-05-09 17:41:59 +02:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2014-05-09 17:41:59 +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("_cat", "fielddata", fields),
params=params,
headers=headers,
2019-05-10 09:16:33 -06:00
)
@query_params(
2022-11-28 14:29:37 -08:00
"format",
"h",
"help",
"include_bootstrap",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"v",
)
2020-03-11 16:33:15 -05:00
def plugins(self, params=None, headers=None):
"""
2019-12-17 22:31:35 +01:00
Returns information about installed plugins across nodes node.
2020-10-20 13:02:15 -05:00
2015-12-08 22:19:32 +01:00
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg include_bootstrap: Include bootstrap plugins in the
response
2019-12-17 22:31:35 +01:00
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
"""
2020-03-11 16:33:15 -05:00
return self.transport.perform_request(
"GET", "/_cat/plugins", params=params, headers=headers
)
2022-11-28 14:29:37 -08:00
@query_params(
"format",
"h",
"help",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"v",
)
2020-03-11 16:33:15 -05:00
def nodeattrs(self, params=None, headers=None):
2015-08-25 01:21:16 +02:00
"""
2019-12-17 22:31:35 +01:00
Returns information about custom node attributes.
2020-10-20 13:02:15 -05:00
2015-08-25 01:21:16 +02:00
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2015-08-25 01:21:16 +02:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2015-08-25 01:21:16 +02:00
"""
2020-03-11 16:33:15 -05:00
return self.transport.perform_request(
"GET", "/_cat/nodeattrs", params=params, headers=headers
)
2015-08-25 01:21:16 +02:00
2022-11-28 14:29:37 -08:00
@query_params(
"format",
"h",
"help",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"v",
)
2020-03-11 16:33:15 -05:00
def repositories(self, params=None, headers=None):
2015-12-08 22:19:32 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns information about snapshot repositories registered in the cluster.
2020-10-20 13:02:15 -05:00
2015-12-08 22:19:32 +01:00
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2015-12-08 22:19:32 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
from master node
2022-11-28 14:29:37 -08:00
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2015-12-08 22:19:32 +01:00
"""
2019-05-10 09:16:33 -06:00
return self.transport.perform_request(
2020-03-11 16:33:15 -05:00
"GET", "/_cat/repositories", params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2015-12-08 22:19:32 +01:00
2019-05-10 09:16:33 -06:00
@query_params(
2022-11-28 14:29:37 -08:00
"format",
"h",
"help",
"ignore_unavailable",
"master_timeout",
"cluster_manager_timeout",
"s",
"time",
"v",
2019-05-10 09:16:33 -06:00
)
2020-03-11 16:33:15 -05:00
def snapshots(self, repository=None, params=None, headers=None):
2015-12-08 22:19:32 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns all snapshots in a specific repository.
2020-10-20 13:02:15 -05:00
2017-01-11 15:42:33 +01:00
2019-12-17 22:31:35 +01:00
:arg repository: Name of repository from which to fetch the
snapshot information
:arg format: a short version of the Accept header, e.g. json,
yaml
2015-12-08 22:19:32 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg ignore_unavailable: Set to true to ignore unavailable
snapshots
2022-11-28 14:29:37 -08:00
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
2020-04-01 09:16:38 -05:00
choices: d, h, m, s, ms, micros, nanos
2019-12-17 22:31:35 +01:00
:arg v: Verbose mode. Display column headers
2015-12-08 22:19:32 +01: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("_cat", "snapshots", repository),
params=params,
headers=headers,
2019-05-10 09:16:33 -06:00
)
2016-05-17 14:12:39 +02:00
2019-05-10 09:16:33 -06:00
@query_params(
"actions",
"detailed",
"format",
"h",
"help",
"nodes",
"parent_task_id",
2019-05-10 09:16:33 -06:00
"s",
2019-12-17 22:31:35 +01:00
"time",
2019-05-10 09:16:33 -06:00
"v",
)
2020-03-11 16:33:15 -05:00
def tasks(self, params=None, headers=None):
2016-05-17 14:12:39 +02:00
"""
2019-12-17 22:31:35 +01:00
Returns information about the tasks currently executing on one or more nodes in
the cluster.
2020-10-20 13:02:15 -05:00
2017-01-11 15:42:33 +01:00
2019-12-17 22:31:35 +01:00
:arg actions: A comma-separated list of actions that should be
returned. Leave empty to return all.
2016-05-17 14:12:39 +02:00
:arg detailed: Return detailed task information (default: false)
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2016-05-17 14:12:39 +02:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg nodes: 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 parent_task_id: Return tasks with specified parent task id
(node_id:task_number). Set to -1 to return all.
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg time: The unit in which to display time values Valid
2020-04-01 09:16:38 -05:00
choices: d, h, m, s, ms, micros, nanos
2019-12-17 22:31:35 +01:00
:arg v: Verbose mode. Display column headers
2016-05-17 14:12:39 +02:00
"""
2020-03-11 16:33:15 -05:00
return self.transport.perform_request(
"GET", "/_cat/tasks", params=params, headers=headers
)
2016-05-17 14:12:39 +02:00
2022-11-28 14:29:37 -08:00
@query_params(
"format",
"h",
"help",
"local",
"master_timeout",
"cluster_manager_timeout",
"s",
"v",
)
2020-03-11 16:33:15 -05:00
def templates(self, name=None, params=None, headers=None):
2017-01-11 15:42:33 +01:00
"""
2019-12-17 22:31:35 +01:00
Returns information about existing templates.
2020-10-20 13:02:15 -05:00
2017-01-11 15:42:33 +01:00
:arg name: A pattern that returned template names must match
2019-12-17 22:31:35 +01:00
:arg format: a short version of the Accept header, e.g. json,
yaml
2017-01-11 15:42:33 +01:00
:arg h: Comma-separated list of column names to display
2019-12-17 22:31:35 +01:00
:arg help: Return help information
:arg local: Return local information, do not retrieve the state
2022-11-28 14:29:37 -08:00
from cluster_manager node (default: false)
:arg master_timeout (Deprecated: use cluster_manager_timeout): Explicit operation timeout for connection
2019-12-17 22:31:35 +01:00
to master node
2022-11-28 14:29:37 -08:00
:arg cluster_manager_timeout: Explicit operation timeout for connection
to cluster_manager node
2019-12-17 22:31:35 +01:00
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg v: Verbose mode. Display column headers
2017-01-11 15:42:33 +01: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("_cat", "templates", name), params=params, headers=headers
2019-05-10 09:16:33 -06:00
)
2020-04-01 09:16:38 -05:00
@query_params(
"allow_no_match", "format", "from_", "h", "help", "s", "size", "time", "v"
)
2020-04-03 12:52:11 -05:00
def transforms(self, transform_id=None, params=None, headers=None):
2020-04-01 09:16:38 -05:00
"""
2020-04-03 12:52:11 -05:00
Gets configuration and usage information about transforms.
2020-10-20 13:02:15 -05:00
2020-04-01 09:16:38 -05:00
:arg transform_id: The id of the transform for which to get
stats. '_all' or '*' implies all transforms
:arg allow_no_match: Whether to ignore if a wildcard expression
matches no transforms. (This includes `_all` string or when no
transforms have been specified)
:arg format: a short version of the Accept header, e.g. json,
yaml
:arg from_: skips a number of transform configs, defaults to 0
:arg h: Comma-separated list of column names to display
:arg help: Return help information
:arg s: Comma-separated list of column names or column aliases
to sort by
:arg size: specifies a max number of transforms to get, defaults
to 100
:arg time: The unit in which to display time values Valid
2020-04-03 12:52:11 -05:00
choices: d, h, m, s, ms, micros, nanos
2020-04-01 09:16:38 -05:00
:arg v: Verbose mode. Display column headers
"""
# from is a reserved word so it cannot be used, use from_ instead
if "from_" in params:
params["from"] = params.pop("from_")
return self.transport.perform_request(
"GET",
_make_path("_cat", "transforms", transform_id),
params=params,
headers=headers,
)