Updated to new ES api version
This commit is contained in:
@@ -1160,7 +1160,7 @@ class Elasticsearch(object):
|
||||
_make_path('_scripts', lang, id), params=params)
|
||||
return data
|
||||
|
||||
@query_params()
|
||||
@query_params('op_type', 'version', 'version_type')
|
||||
def put_template(self, id, body, params=None):
|
||||
"""
|
||||
Create a search template.
|
||||
@@ -1168,6 +1168,9 @@ class Elasticsearch(object):
|
||||
|
||||
:arg id: Template ID
|
||||
:arg body: The document
|
||||
:arg op_type: Explicit operation type, default u'index'
|
||||
:arg version: Explicit version number for concurrency control
|
||||
:arg version_type: Specific version type
|
||||
"""
|
||||
for param in (id, body):
|
||||
if param in SKIP_IN_PATH:
|
||||
@@ -1176,28 +1179,31 @@ class Elasticsearch(object):
|
||||
'template', id), params=params, body=body)
|
||||
return data
|
||||
|
||||
@query_params()
|
||||
def get_template(self, id, body=None, params=None):
|
||||
@query_params('version', 'version_type')
|
||||
def get_template(self, id, params=None):
|
||||
"""
|
||||
Retrieve a search template.
|
||||
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html>`_
|
||||
|
||||
:arg id: Template ID
|
||||
:arg body: The document
|
||||
:arg version: Explicit version number for concurrency control
|
||||
:arg version_type: Specific version type
|
||||
"""
|
||||
if id in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'id'.")
|
||||
_, data = self.transport.perform_request('GET', _make_path('_search',
|
||||
'template', id), params=params, body=body)
|
||||
_, data = self.transport.perform_request('GET', _make_path('_search', 'template',
|
||||
id), params=params)
|
||||
return data
|
||||
|
||||
@query_params()
|
||||
@query_params('version', 'version_type')
|
||||
def delete_template(self, id=None, params=None):
|
||||
"""
|
||||
Delete a search template.
|
||||
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html>`_
|
||||
|
||||
:arg id: Template ID
|
||||
:arg version: Explicit version number for concurrency control
|
||||
:arg version_type: Specific version type
|
||||
"""
|
||||
_, data = self.transport.perform_request('DELETE', _make_path('_search',
|
||||
'template', id), params=params)
|
||||
|
||||
@@ -112,7 +112,7 @@ class ClusterClient(NamespacedClient):
|
||||
_, data = self.transport.perform_request('GET', '/_cluster/settings', params=params)
|
||||
return data
|
||||
|
||||
@query_params('flat_settings')
|
||||
@query_params('flat_settings', 'master_timeout', 'timeout')
|
||||
def put_settings(self, body, params=None):
|
||||
"""
|
||||
Update cluster wide specific settings.
|
||||
@@ -121,6 +121,9 @@ 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)
|
||||
:arg master_timeout: Explicit operation timeout for connection to master
|
||||
node
|
||||
:arg timeout: Explicit operation timeout
|
||||
"""
|
||||
_, data = self.transport.perform_request('PUT', '/_cluster/settings', params=params, body=body)
|
||||
return data
|
||||
|
||||
@@ -102,7 +102,8 @@ class IndicesClient(NamespacedClient):
|
||||
'local')
|
||||
def get(self, index, feature=None, params=None):
|
||||
"""
|
||||
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get.html>`_
|
||||
The get index API allows to retrieve information about one or more indexes.
|
||||
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-index.html>`_
|
||||
|
||||
:arg index: A comma-separated list of index names
|
||||
:arg feature: A comma-separated list of features
|
||||
@@ -361,8 +362,9 @@ class IndicesClient(NamespacedClient):
|
||||
:arg master_timeout: Specify timeout for connection to master
|
||||
:arg timeout: Explicit timestamp for the document
|
||||
"""
|
||||
if name in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument 'name'.")
|
||||
for param in (index, name):
|
||||
if param in SKIP_IN_PATH:
|
||||
raise ValueError("Empty value passed for a required argument.")
|
||||
_, data = self.transport.perform_request('PUT', _make_path(index, '_alias', name),
|
||||
params=params, body=body)
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user