简体   繁体   English

从Elasticsearch群集的索引中获取所有文档,然后在另一个ElasticSearch群集中对其进行索引

[英]Get all documents from an index of an elasticsearch cluster and index it in another elasticsearch cluster

My goal here is to get all documents from an index of an ES cluster and insert them in another ES cluster keeping the same metadata. 我的目标是从ES群集的索引中获取所有文档,并将它们插入保留相同元数据的另一个ES群集中​​。

I had a look at mget API to retrieve data and Bulk API to insert it but this Bulk API needs a special structure: 我看过mget API来检索数据,然后使用Bulk API插入数据,但是该Bulk API需要特殊的结构:

action_and_meta_data\n
optional_source\n
action_and_meta_data\n
optional_source\n

So my idea is to retrieve my data of EScluster1 in a file and rearranged it to meet the structure of Bulk API and index it to EScluster2. 因此,我的想法是在一个文件中检索我的EScluster1数据,并将其重新排列以符合Bulk API的结构并将其索引到EScluster2。

Do you see a better and/or faster way to proceed? 您是否看到更好和/或更快速的进行方式?

elasticdump does this. elasticdump做到这一点。 If you want to do this manually, you'll want to query using scroll and then bulk index what comes out of that. 如果要手动执行此操作,则需要使用滚动查询,然后使用大容量索引查询结果。 Not too hard to script together. 一起编写脚本不太难。 With elastic dump you can pump the data around without writing to a file. 使用弹性转储,您可以在不写入文件的情况下泵送数据。 However, it is kind of limited when you have eg parent/child relations in your index. 但是,当您的索引中具有父/子关系时,这是一种限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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