Index using Elasticsearch.py

I want to reindex some data from other server to my new server. I want to use python script for this.
I use the elasticsearch.py plugin.

Does anyone here tried this?

I have a defficulty with regards to the body of the document.

index = es_dest.index(
 index = 'new_index',
 doc_type = log,
 id = 'asdadas',
 body = data_body
)

data_body variable is the one that i got inside the ['hits']['hits']

Hi @jogoinar10,

if your target cluster is on a somewhat recent version of Elasticsearch (5.0 or better), you can use reindex-from-remote without writing any code. Alternatively, there is the Reindex helper in the Elasticsearch Python client which should greatly simplify your task.

Daniel

1 Like

You can also use Elasticsearch Curator for this, or its Reindex API, which is Python.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.