问题
I am looking for the tools to migrate data from 1.x to 2.x elasticsearch. Please suggest if anything is available?
回答1:
You have a few options. You can use Logstash in order to copy indices from your old 1.x ES to your new 2.x ES:
input {
elasticsearch {
hosts => ["old-es:9200"] <--- source ES host
index => "source_index" <--- source index to copy
docinfo => true
}
}
filter {
mutate {
remove_field => [ "@version", "@timestamp" ] <--- remove added junk
}
}
output {
elasticsearch {
hosts => ["new-es:9200]" <--- target ES host
index => "%{[@metadata][_index]}"
document_type => "%{[@metadata][_type]}"
document_id => "%{[@metadata][_id]}"
}
}
You can also use elasticdump and use the following commands to copy source_index
from old-es:9200
to your new-es:9200
host:
elasticdump \
--input=http://old-es:9200/source_index \
--output=http://new-es:9200/source_index \
--type=analyzer
elasticdump \
--input=http://old-es:9200/source_index \
--output=http://new-es:9200/source_index \
--type=mapping
elasticdump \
--input=http://old-es:9200/source_index \
--output=http://new-es:9200/source_index \
--type=data
来源:https://stackoverflow.com/questions/38517663/tools-to-migrate-index-from-elasticsearch-1-x-to-elasticsearch-2-x