我是Elasticsearch的新手。如何使用Bulk API将数据从一个Elasticsearch索引移动到另一个?
答案 0 :(得分:0)
我建议您使用Logstash,即使用一个elasticsearch
input插件从索引中检索数据,使用另一个elasticsearch
output插件将数据推送到其他索引。
config 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
}
}
在installing Logstash之后,你可以像这样运行它:
bin/logstash -f logstash.conf