From 7785dd150d13e901322a232fe353b76646398d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Wed, 30 Oct 2019 18:08:31 +0100 Subject: [PATCH] Adding indices.clone --- elasticsearch/client/indices.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/elasticsearch/client/indices.py b/elasticsearch/client/indices.py index 4457b4e7..6b9481c1 100644 --- a/elasticsearch/client/indices.py +++ b/elasticsearch/client/indices.py @@ -106,6 +106,32 @@ class IndicesClient(NamespacedClient): "PUT", _make_path(index), params=params, body=body ) + @query_params( + "master_timeout", + "timeout", + "wait_for_active_shards" + ) + def clone(self, index, target, body=None, params=None): + """ + Clones an index + ``_ + + :arg index: The name of the source index to clone + :arg target: The name of the target index to clone into + :arg master_timeout: Specify timeout for connection to master + :arg timeout: Explicit operation timeout + :arg wait_for_active_shards: Set the number of active shards to wait for + before the operation returns. + """ + if index in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'index'.") + if target in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'target'.") + + return self.transport.perform_request( + "PUT", _make_path(index, '_clone', target), params=params, body=body + ) + @query_params( "allow_no_indices", "expand_wildcards",