From 477e5c236622474874f5f637a511af28c82bca32 Mon Sep 17 00:00:00 2001 From: Honza Kral Date: Wed, 24 Jul 2013 03:47:28 +0200 Subject: [PATCH] open/close APIs --- elasticsearch/client/indices.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/elasticsearch/client/indices.py b/elasticsearch/client/indices.py index 08644a87..52e17a6e 100644 --- a/elasticsearch/client/indices.py +++ b/elasticsearch/client/indices.py @@ -63,6 +63,32 @@ class IndicesClient(NamespacedClient): status, data = self.transport.perform_request('PUT', _make_path(index), params=params, body=body) return data + @query_params('timeout', 'master_timeout') + def open(self, index, params=None): + """ + The open and close index APIs allow to close an index, and later on opening it. + http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close/ + + :arg index: The name of the index + :arg master_timeout: Specify timeout for connection to master + :arg timeout: Explicit operation timeout + """ + status, data = self.transport.perform_request('POST', _make_path(index, '_open'), params=params) + return data + + @query_params('timeout', 'master_timeout') + def close(self, index, params=None): + """ + The open and close index APIs allow to close an index, and later on opening it. + http://www.elasticsearch.org/guide/reference/api/admin-indices-open-close/ + + :arg index: The name of the index + :arg master_timeout: Specify timeout for connection to master + :arg timeout: Explicit operation timeout + """ + status, data = self.transport.perform_request('POST', _make_path(index, '_close'), params=params) + return data + @query_params('timeout', 'master_timeout') def delete(self, index=None, params=None): """