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

310 lines
14 KiB
Python
Raw Normal View History

2014-01-18 01:30:31 +01:00
from .utils import NamespacedClient, query_params, _make_path
class CatClient(NamespacedClient):
@query_params('h', 'help', 'local', 'master_timeout', 'v')
def aliases(self, name=None, params=None):
"""
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-alias.html>`_
2014-01-18 01:30:31 +01:00
:arg name: A comma-separated list of alias names to return
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', _make_path('_cat',
'aliases', name), params=params)
return data
2014-04-28 19:19:02 +02:00
2014-01-18 01:30:31 +01:00
@query_params('bytes', 'h', 'help', 'local', 'master_timeout', 'v')
def allocation(self, node_id=None, params=None):
"""
Allocation provides a snapshot of how shards have located around the
cluster and the state of disk usage.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html>`_
2014-01-18 01:30:31 +01:00
:arg node_id: A comma-separated list of node IDs or names to limit the
returned information
2015-08-25 01:21:16 +02:00
:arg bytes: The unit in which to display byte values, valid choices are:
'b', 'k', 'm', 'g'
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', _make_path('_cat',
'allocation', node_id), params=params)
return data
2014-04-28 19:19:02 +02:00
2014-01-18 01:30:31 +01:00
@query_params('h', 'help', 'local', 'master_timeout', 'v')
def count(self, index=None, params=None):
"""
Count provides quick access to the document count of the entire cluster,
or individual indices.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-count.html>`_
2014-01-18 01:30:31 +01:00
:arg index: A comma-separated list of index names to limit the returned
information
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', _make_path('_cat',
'count', index), params=params)
return data
2014-04-28 19:19:02 +02:00
2014-01-18 01:30:31 +01:00
@query_params('h', 'help', 'local', 'master_timeout', 'ts', 'v')
def health(self, params=None):
"""
health is a terse, one-line representation of the same information from
:meth:`~elasticsearch.client.cluster.ClusterClient.health` API
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-health.html>`_
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
:arg ts: Set to false to disable timestamping, default True
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', '/_cat/health',
params=params)
return data
2014-04-28 19:19:02 +02:00
2014-01-18 01:30:31 +01:00
@query_params('help')
def help(self, params=None):
"""
A simple help for the cat api.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html>`_
2014-01-18 01:30:31 +01:00
2014-04-28 19:19:02 +02:00
:arg help: Return help information, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', '/_cat', params=params)
return data
2014-04-28 19:19:02 +02:00
2014-01-18 01:30:31 +01:00
@query_params('bytes', 'h', 'help', 'local', 'master_timeout', 'pri', 'v')
def indices(self, index=None, params=None):
"""
The indices command provides a cross-section of each index.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html>`_
2014-01-18 01:30:31 +01:00
:arg index: A comma-separated list of index names to limit the returned
information
2015-08-25 01:21:16 +02:00
:arg bytes: The unit in which to display byte values, valid choices are:
'b', 'k', 'm', 'g'
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
:arg pri: Set to true to return stats only for primary shards, default
False
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', _make_path('_cat',
'indices', index), params=params)
return data
2014-04-28 19:19:02 +02:00
2014-01-18 01:30:31 +01:00
@query_params('h', 'help', 'local', 'master_timeout', 'v')
def master(self, params=None):
"""
2014-01-18 01:54:01 +01:00
Displays the master's node ID, bound IP address, and node name.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-master.html>`_
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', '/_cat/master',
params=params)
return data
2014-04-28 19:19:02 +02:00
2015-08-25 01:21:16 +02:00
@query_params('h', 'help', 'local', 'master_timeout', 'v')
2014-01-18 01:30:31 +01:00
def nodes(self, params=None):
"""
The nodes command shows the cluster topology.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html>`_
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', '/_cat/nodes',
params=params)
return data
2014-04-28 19:19:02 +02:00
2015-08-25 01:21:16 +02:00
@query_params('bytes', 'h', 'help', 'master_timeout', 'v')
2014-01-18 01:30:31 +01:00
def recovery(self, index=None, params=None):
"""
recovery is a view of shard replication.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html>`_
2014-01-18 01:30:31 +01:00
:arg index: A comma-separated list of index names to limit the returned
information
2015-08-25 01:21:16 +02:00
:arg bytes: The unit in which to display byte values, valid choices are:
'b', 'k', 'm', 'g'
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', _make_path('_cat',
'recovery', index), params=params)
return data
2014-04-28 19:19:02 +02:00
2015-08-25 01:21:16 +02:00
@query_params('h', 'help', 'local', 'master_timeout', 'v')
2014-01-18 01:30:31 +01:00
def shards(self, index=None, params=None):
"""
The shards command is the detailed view of what nodes contain which shards.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-shards.html>`_
2014-01-18 01:30:31 +01:00
:arg index: A comma-separated list of index names to limit the returned
information
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', _make_path('_cat',
'shards', index), params=params)
return data
2014-04-23 17:39:25 +02:00
2015-08-25 01:21:16 +02:00
@query_params('h', 'help', 'v')
2014-04-23 17:39:25 +02:00
def segments(self, index=None, params=None):
"""
The segments command is the detailed view of Lucene segments per index.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-segments.html>`_
2014-04-23 17:39:25 +02:00
:arg index: A comma-separated list of index names to limit the returned
information
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-04-23 17:39:25 +02:00
"""
_, data = self.transport.perform_request('GET', _make_path('_cat',
'segments', index), params=params)
return data
2014-04-28 19:19:02 +02:00
2014-01-18 01:30:31 +01:00
@query_params('h', 'help', 'local', 'master_timeout', 'v')
def pending_tasks(self, params=None):
"""
pending_tasks provides the same information as the
:meth:`~elasticsearch.client.cluster.ClusterClient.pending_tasks` API
in a convenient tabular format.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-pending-tasks.html>`_
2014-01-18 01:30:31 +01:00
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-01-18 01:30:31 +01:00
"""
_, data = self.transport.perform_request('GET', '/_cat/pending_tasks',
params=params)
return data
2014-04-28 19:19:02 +02:00
2014-02-10 18:14:30 +01:00
@query_params('full_id', 'h', 'help', 'local', 'master_timeout', 'v')
def thread_pool(self, params=None):
"""
Get information about thread pools.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-thread-pool.html>`_
2014-02-10 18:14:30 +01:00
2015-08-25 01:21:16 +02:00
:arg full_id: Enables displaying the complete node ids, default False
2014-02-10 18:14:30 +01:00
:arg h: Comma-separated list of column names to display
2015-08-25 01:21:16 +02:00
:arg help: Return help information, default False
2014-02-10 18:14:30 +01:00
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-02-10 18:14:30 +01:00
"""
_, data = self.transport.perform_request('GET', '/_cat/thread_pool',
params=params)
return data
2014-05-09 17:41:59 +02:00
2015-08-28 17:41:04 +02:00
@query_params('bytes', 'h', 'help', 'local', 'master_timeout', 'v')
2014-05-09 17:41:59 +02:00
def fielddata(self, fields=None, params=None):
"""
Shows information about currently loaded fielddata on a per-node basis.
2015-08-25 01:21:16 +02:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-fielddata.html>`_
2014-05-09 17:41:59 +02:00
:arg fields: A comma-separated list of fields to return the fielddata
size
2015-08-25 01:21:16 +02:00
:arg bytes: The unit in which to display byte values, valid choices are:
'b', 'k', 'm', 'g'
2014-05-09 17:41:59 +02:00
:arg h: Comma-separated list of column names to display
2015-08-25 01:21:16 +02:00
:arg help: Return help information, default False
2014-05-09 17:41:59 +02:00
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2014-05-09 17:41:59 +02:00
"""
_, data = self.transport.perform_request('GET', _make_path('_cat',
'fielddata', fields), params=params)
return data
@query_params('h', 'help', 'local', 'master_timeout', 'v')
def plugins(self, params=None):
"""
2015-08-25 01:21:16 +02:00
2015-03-23 15:25:45 -07:00
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-plugins.html>`_
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
"""
_, data = self.transport.perform_request('GET', '/_cat/plugins',
params=params)
return data
2015-08-25 01:21:16 +02:00
@query_params('h', 'help', 'local', 'master_timeout', 'v')
def nodeattrs(self, params=None):
"""
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodeattrs.html>`_
:arg h: Comma-separated list of column names to display
:arg help: Return help information, default False
:arg local: Return local information, do not retrieve the state from
master node (default: false)
:arg master_timeout: Explicit operation timeout for connection to master
node
2015-10-14 00:06:27 +02:00
:arg v: Verbose mode. Display column headers, default False
2015-08-25 01:21:16 +02:00
"""
_, data = self.transport.perform_request('GET', '/_cat/nodeattrs',
params=params)
return data