Skip to content

Commit f9b7038

Browse files
committed
Added versioning support to *_script APIs
1 parent 44060a4 commit f9b7038

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

elasticsearch/client/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ def list_benchmarks(self, index=None, doc_type=None, params=None):
10021002
doc_type, '_bench'), params=params)
10031003
return data
10041004

1005-
@query_params()
1005+
@query_params('op_type', 'version', 'version_type')
10061006
def put_script(self, lang, id, body, params=None):
10071007
"""
10081008
Create a script in given language with specified ID.
@@ -1011,32 +1011,39 @@ def put_script(self, lang, id, body, params=None):
10111011
:arg lang: Script language
10121012
:arg id: Script ID
10131013
:arg body: The document
1014+
:arg op_type: Explicit operation type, default u'index'
1015+
:arg version: Explicit version number for concurrency control
1016+
:arg version_type: Specific version type
10141017
"""
10151018
_, data = self.transport.perform_request('PUT', _make_path('_scripts',
10161019
lang, id), params=params, body=body)
10171020
return data
10181021

1019-
@query_params()
1022+
@query_params('version', 'version_type')
10201023
def get_script(self, lang, id, params=None):
10211024
"""
10221025
Retrieve a script from the API.
10231026
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html>`_
10241027
10251028
:arg lang: Script language
10261029
:arg id: Script ID
1030+
:arg version: Explicit version number for concurrency control
1031+
:arg version_type: Specific version type
10271032
"""
10281033
_, data = self.transport.perform_request('GET', _make_path('_scripts',
10291034
lang, id), params=params)
10301035
return data
10311036

1032-
@query_params()
1037+
@query_params('version', 'version_type')
10331038
def delete_script(self, lang, id, params=None):
10341039
"""
10351040
Remove a stored script from elasticsearch.
10361041
`<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-scripting.html>`_
10371042
10381043
:arg lang: Script language
10391044
:arg id: Script ID
1045+
:arg version: Explicit version number for concurrency control
1046+
:arg version_type: Specific version type
10401047
"""
10411048
_, data = self.transport.perform_request('DELETE',
10421049
_make_path('_scripts', lang, id), params=params)

0 commit comments

Comments
 (0)