I am new to Elasticsearch. How to move data from one Elasticsearch index to another using the Bulk API?
Asked
Active
Viewed 962 times
-3
-
Hello, please elaborate on your question and let us know what you have tried so far. That way we can be more informed to help you in your situation – zanderwar Aug 06 '15 at 10:28
1 Answers
1
I'd suggest using Logstash for this, i.e. you use one elasticsearch
input plugin to retrieve the data from your index and another elasticsearch
output plugin to push the data to your other index.
The config logstash config file would look like this:
input {
elasticsearch {
hosts => "localhost:9200"
index => "source_index" <--- the name of your source index
}
}
filter {
mutate {
remove_field => [ "@version", "@timestamp" ]
}
}
output {
elasticsearch {
host => "localhost"
port => 9200
protocol => "http"
manage_template => false
index => "target_index" <---- the name of your target index
document_type => "your_doc_type" <---- make sure to set the appropriate type
document_id => "%{id}"
workers => 5
}
}
After installing Logstash, you can run it like this:
bin/logstash -f logstash.conf

Val
- 207,596
- 13
- 358
- 360
-
Thank for your replay Valentin, is this possible without logstash and using only Bulk API in Elasticsearch. – suman babu Aug 06 '15 at 10:54
-
Yes, basically by re-implementing what logstash does :-) There are plenty of examples available, one of which is [here](http://stackoverflow.com/questions/26371237/reindexing-elastic-search-via-bulk-api-scan-and-scroll). If you're using Python, you can use the [`reindex` helper](http://elasticsearch-py.readthedocs.org/en/latest/helpers.html#elasticsearch.helpers.reindex). – Val Aug 06 '15 at 11:26