From a180459d692dc9451f3bcf0c8c3da552db57828e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Wed, 8 Feb 2017 21:07:29 +0100 Subject: [PATCH] Update API parameters to 5.x --- elasticsearch/client/indices.py | 22 ++++++++-------------- elasticsearch/client/nodes.py | 21 ++++++++++----------- elasticsearch/client/utils.py | 2 +- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/elasticsearch/client/indices.py b/elasticsearch/client/indices.py index c1a8fb9c..dea74949 100644 --- a/elasticsearch/client/indices.py +++ b/elasticsearch/client/indices.py @@ -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) """ diff --git a/elasticsearch/client/nodes.py b/elasticsearch/client/nodes.py index 6adc61d1..2df280b0 100644 --- a/elasticsearch/client/nodes.py +++ b/elasticsearch/client/nodes.py @@ -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. - ``_ + ``_ :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. - ``_ + ``_ :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. - ``_ + ``_ :arg node_id: A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the diff --git a/elasticsearch/client/utils.py b/elasticsearch/client/utils.py index 5500128a..78b005cd 100644 --- a/elasticsearch/client/utils.py +++ b/elasticsearch/client/utils.py @@ -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): """