Index using Elasticsearch.py


(Jonar B) #1

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']


(Daniel Mitterdorfer) #2

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


(Aaron Mildenstein) #3

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


(system) #4

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