Update API parameters to 5.x

This commit is contained in:
Honza Král
2017-02-08 21:07:29 +01:00
parent a96f5f7284
commit a180459d69
3 changed files with 19 additions and 26 deletions
+8 -14
View File
@@ -564,7 +564,7 @@ class IndicesClient(NamespacedClient):
'_settings'), params=params, body=body)
@query_params('completion_fields', 'fielddata_fields', 'fields', 'groups',
'human', 'level', 'types')
'include_segment_file_sizes', 'level', 'types')
def stats(self, index=None, metric=None, params=None):
"""
Retrieve statistics on different operations happening on an index.
@@ -581,8 +581,9 @@ class IndicesClient(NamespacedClient):
`completion` index metric (supports wildcards)
:arg groups: A comma-separated list of search groups for `search` index
metric
:arg human: Whether to return time and byte values in human-readable
format., default False
:arg include_segment_file_sizes: Whether to report the aggregated disk
usage of each one of the Lucene index files (only applies if segment
stats are requested), default False
:arg level: Return stats aggregated at cluster, index or shard level,
default 'indices', valid choices are: 'cluster', 'indices', 'shards'
:arg types: A comma-separated list of document types for the `indexing`
@@ -591,8 +592,8 @@ class IndicesClient(NamespacedClient):
return self.transport.perform_request('GET', _make_path(index,
'_stats', metric), params=params)
@query_params('allow_no_indices', 'expand_wildcards', 'human',
'ignore_unavailable', 'operation_threading', 'verbose')
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable',
'operation_threading', 'verbose')
def segments(self, index=None, params=None):
"""
Provide low level segments information that a Lucene index (shard level) is built with.
@@ -606,8 +607,6 @@ class IndicesClient(NamespacedClient):
:arg expand_wildcards: Whether to expand wildcard expression to concrete
indices that are open, closed or both., default 'open', valid
choices are: 'open', 'closed', 'none', 'all'
:arg human: Whether to return time and byte values in human-readable
format., default False
:arg ignore_unavailable: Whether specified concrete indices should be
ignored when unavailable (missing or closed)
:arg operation_threading: TODO: ?
@@ -687,7 +686,7 @@ class IndicesClient(NamespacedClient):
return self.transport.perform_request('POST', _make_path(index,
'_cache', 'clear'), params=params)
@query_params('active_only', 'detailed', 'human')
@query_params('active_only', 'detailed')
def recovery(self, index=None, params=None):
"""
The indices recovery API provides insight into on-going shard
@@ -701,8 +700,6 @@ class IndicesClient(NamespacedClient):
going, default False
:arg detailed: Whether to display detailed information about shard
recovery, default False
:arg human: Whether to return time and byte values in human-readable
format., default False
"""
return self.transport.perform_request('GET', _make_path(index,
'_recovery'), params=params)
@@ -732,8 +729,7 @@ class IndicesClient(NamespacedClient):
return self.transport.perform_request('POST', _make_path(index,
'_upgrade'), params=params)
@query_params('allow_no_indices', 'expand_wildcards', 'human',
'ignore_unavailable')
@query_params('allow_no_indices', 'expand_wildcards', 'ignore_unavailable')
def get_upgrade(self, index=None, params=None):
"""
Monitor how much of one or more index is upgraded.
@@ -747,8 +743,6 @@ class IndicesClient(NamespacedClient):
:arg expand_wildcards: Whether to expand wildcard expression to concrete
indices that are open, closed or both., default 'open', valid
choices are: 'open', 'closed', 'none', 'all'
:arg human: Whether to return time and byte values in human-readable
format., default False
:arg ignore_unavailable: Whether specified concrete indices should be
ignored when unavailable (missing or closed)
"""
+10 -11
View File
@@ -1,12 +1,12 @@
from .utils import NamespacedClient, query_params, _make_path
class NodesClient(NamespacedClient):
@query_params('flat_settings', 'human', 'timeout')
@query_params('flat_settings', 'timeout')
def info(self, node_id=None, metric=None, params=None):
"""
The cluster nodes info API allows to retrieve one or more (or all) of
the cluster nodes information.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-info.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-info.html>`_
:arg node_id: A comma-separated list of node IDs or names to limit the
returned information; use `_local` to return information from the
@@ -15,20 +15,18 @@ class NodesClient(NamespacedClient):
:arg metric: A comma-separated list of metrics you wish returned. Leave
empty to return all.
:arg flat_settings: Return settings in flat format (default: false)
:arg human: Whether to return time and byte values in human-readable
format., default False
:arg timeout: Explicit operation timeout
"""
return self.transport.perform_request('GET', _make_path('_nodes',
node_id, metric), params=params)
@query_params('completion_fields', 'fielddata_fields', 'fields', 'groups',
'human', 'level', 'timeout', 'types')
'include_segment_file_sizes', 'level', 'timeout', 'types')
def stats(self, node_id=None, metric=None, index_metric=None, params=None):
"""
The cluster nodes stats API allows to retrieve one or more (or all) of
the cluster nodes statistics.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html>`_
:arg node_id: A comma-separated list of node IDs or names to limit the
returned information; use `_local` to return information from the
@@ -46,10 +44,11 @@ class NodesClient(NamespacedClient):
`completion` index metric (supports wildcards)
:arg groups: A comma-separated list of search groups for `search` index
metric
:arg human: Whether to return time and byte values in human-readable
format., default False
:arg level: Return indices stats aggregated at node, index or shard
level, default 'node', valid choices are: 'node', 'indices',
:arg include_segment_file_sizes: Whether to report the aggregated disk
usage of each one of the Lucene index files (only applies if segment
stats are requested), default False
:arg level: Return indices stats aggregated at index, node or shard
level, default 'node', valid choices are: 'indices', 'node',
'shards'
:arg timeout: Explicit operation timeout
:arg types: A comma-separated list of document types for the `indexing`
@@ -63,7 +62,7 @@ class NodesClient(NamespacedClient):
def hot_threads(self, node_id=None, params=None):
"""
An API allowing to get the current hot threads on each node in the cluster.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html>`_
`<https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-hot-threads.html>`_
:arg node_id: A comma-separated list of node IDs or names to limit the
returned information; use `_local` to return information from the
+1 -1
View File
@@ -47,7 +47,7 @@ def _make_path(*parts):
quote_plus(_escape(p), b',*') for p in parts if p not in SKIP_IN_PATH)
# parameters that apply to all methods
GLOBAL_PARAMS = ('pretty', 'format', 'filter_path')
GLOBAL_PARAMS = ('pretty', 'human', 'error_trace', 'format', 'filter_path')
def query_params(*es_query_params):
"""