简体   繁体   中英

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

I am looking for the tools to migrate data from 1.x to 2.x elasticsearch. Please suggest if anything is available?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM