Add support for flat_settings flag to all REST APIs that output settings

See https://github.com/elasticsearch/elasticsearch/issues/4140
This commit is contained in:
Honza Král
2014-01-08 19:44:56 +01:00
parent 08b2e94333
commit 80dcf406b7
2 changed files with 15 additions and 7 deletions
+7 -3
View File
@@ -25,7 +25,7 @@ class ClusterClient(NamespacedClient):
@query_params('filter_blocks', 'filter_index_templates', 'filter_indices',
'filter_metadata', 'filter_nodes', 'filter_routing_table', 'local',
'master_timeout')
'master_timeout', 'flat_settings')
def state(self, params=None):
"""
Get a comprehensive state information of the whole cluster.
@@ -39,6 +39,7 @@ class ClusterClient(NamespacedClient):
:arg filter_routing_table: Do not return information about shard allocation (`routing_table` and `routing_nodes`)
:arg local: Return local information, do not retrieve the state from master node (default: false)
:arg master_timeout: Specify timeout for connection to master
:arg flat_settings: Return settings in flat format (default: false)
"""
_, data = self.transport.perform_request('GET', '/_cluster/state', params=params)
return data
@@ -57,16 +58,18 @@ class ClusterClient(NamespacedClient):
_, data = self.transport.perform_request('POST', '/_cluster/reroute', params=params, body=body)
return data
@query_params()
@query_params('flat_settings')
def get_settings(self, params=None):
"""
Get cluster settings.
`<http://elasticsearch.org/guide/reference/api/admin-cluster-update-settings/>`_
:arg flat_settings: Return settings in flat format (default: false)
"""
_, data = self.transport.perform_request('GET', '/_cluster/settings', params=params)
return data
@query_params()
@query_params('flat_settings')
def put_settings(self, body, params=None):
"""
Update cluster wide specific settings.
@@ -74,6 +77,7 @@ class ClusterClient(NamespacedClient):
:arg body: The settings to be updated. Can be either `transient` or
`persistent` (survives cluster restart).
:arg flat_settings: Return settings in flat format (default: false)
"""
_, data = self.transport.perform_request('PUT', '/_cluster/settings', params=params, body=body)
return data
+8 -4
View File
@@ -366,7 +366,7 @@ class IndicesClient(NamespacedClient):
params=params)
return data
@query_params('order', 'timeout', 'master_timeout')
@query_params('order', 'timeout', 'master_timeout', 'flat_settings')
def put_template(self, name, body, params=None):
"""
Create an index template that will automatically be applied to new
@@ -379,18 +379,20 @@ class IndicesClient(NamespacedClient):
ones (higher numbers are merged later, overriding the lower numbers)
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
:arg flat_settings: Return settings in flat format (default: false)
"""
_, data = self.transport.perform_request('PUT', _make_path('_template', name),
params=params, body=body)
return data
@query_params()
@query_params('flat_settings')
def get_template(self, name=None, params=None):
"""
Retrieve an index template by its name.
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html>`_
:arg name: The name of the template
:arg flat_settings: Return settings in flat format (default: false)
"""
_, data = self.transport.perform_request('GET', _make_path('_template', name),
params=params)
@@ -410,7 +412,7 @@ class IndicesClient(NamespacedClient):
params=params)
return data
@query_params()
@query_params('flat_settings')
def get_settings(self, index=None, params=None):
"""
Retrieve settings for one or more (or all) indices.
@@ -418,12 +420,13 @@ class IndicesClient(NamespacedClient):
:arg index: A comma-separated list of index names; use `_all` or empty
string to perform the operation on all indices
:arg flat_settings: Return settings in flat format (default: false)
"""
_, data = self.transport.perform_request('GET', _make_path(index, '_settings'),
params=params)
return data
@query_params('master_timeout')
@query_params('master_timeout', 'flat_settings')
def put_settings(self, body, index=None, params=None):
"""
Change specific index level settings in real time.
@@ -433,6 +436,7 @@ class IndicesClient(NamespacedClient):
string to perform the operation on all indices
:arg master_timeout: Specify timeout for connection to master
:arg body: The index settings to be updated
:arg flat_settings: Return settings in flat format (default: false)
"""
_, data = self.transport.perform_request('PUT', _make_path(index, '_settings'),
params=params, body=body)