如何使用Bulk API将数据从一个Elasticsearch索引移动到另一个



我是Elasticsearch的新手。如何移动数据从一个Elasticsearch索引到另一个使用批量API?

我建议使用Logstash,即您使用一个elasticsearch输入插件从您的索引检索数据,另一个elasticsearch输出插件将数据推送到您的其他索引。

配置logstash配置文件看起来像这样:

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
 }
}

安装完Logstash后,你可以这样运行它:

bin/logstash -f logstash.conf

最新更新