diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index eeae2597..9f0f5d61 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -1001,3 +1001,82 @@ class Elasticsearch(object): _, data = self.transport.perform_request('GET', _make_path(index, doc_type, '_bench'), params=params) return data + + @query_params() + def put_script(self, lang, id, body, params=None): + """ + Create a script in given language with specified ID. + ``_ + + :arg lang: Script language + :arg id: Script ID + :arg body: The document + """ + _, data = self.transport.perform_request('PUT', _make_path('_scripts', + lang, id), params=params, body=body) + return data + + @query_params() + def get_script(self, lang, id, params=None): + """ + Retrieve a script from the API. + ``_ + + :arg lang: Script language + :arg id: Script ID + """ + _, data = self.transport.perform_request('GET', _make_path('_scripts', + lang, id), params=params) + return data + + @query_params() + def delete_script(self, lang, id, params=None): + """ + Remove a stored script from elasticsearch. + ``_ + + :arg lang: Script language + :arg id: Script ID + """ + _, data = self.transport.perform_request('DELETE', + _make_path('_scripts', lang, id), params=params) + return data + + @query_params() + def put_template(self, id, body, params=None): + """ + Create a search template. + ``_ + + :arg id: Template ID + :arg body: The document + """ + _, data = self.transport.perform_request('PUT', _make_path('_search', + 'template', id), params=params, body=body) + return data + + @query_params() + def get_template(self, id, body=None, params=None): + """ + Retrieve a search template. + ``_ + + :arg id: Template ID + :arg body: The document + """ + _, data = self.transport.perform_request('GET', _make_path('_search', + 'template', id), params=params, body=body) + return data + + @query_params() + def delete_template(self, id=None, params=None): + """ + Delete a search template. + ``_ + + :arg id: Template ID + """ + _, data = self.transport.perform_request('DELETE', _make_path('_search', + 'template', id), params=params) + return data +