Tools to migrate index from elasticsearch 1.x to elasticsearch 2.x

风格不统一 提交于 2020-01-26 03:11:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!