'How to clone elasticsearch index to another index using python requests library?

I am trying to do as in title with the following code:

resp = requests.post("http://es_7:9200/my-index/_clone/new-my-index")

And I get this error:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://es_7:9200/my-index/_clone/new-my-index

Seems like it is not existing query, but as per docs it should work fine. https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clone-index.html

What may be the issue? Thanks in advance



Solution 1:[1]

This route was added in the release 7.4

Could it be you are using a prior release ?

I am using version 7.0.1 how to clone the index within this version?

To perform a clone like operation:

In the case you wish to perform a _clone artificially.

Say you have index1 as the original index and index2 being the clone,

I believe you have to :

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1