【发布时间】:2015-10-29 10:54:04
【问题描述】:
我是 Elasticsearch 的新手。如何使用 Bulk API 将数据从一个 Elasticsearch 索引移动到另一个?
【问题讨论】:
-
您好,请详细说明您的问题,让我们知道您到目前为止所做的尝试。这样我们就可以更了解情况以帮助您解决您的情况
标签: elasticsearch
我是 Elasticsearch 的新手。如何使用 Bulk API 将数据从一个 Elasticsearch 索引移动到另一个?
【问题讨论】:
标签: elasticsearch
我建议为此使用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
【讨论】:
reindex helper。