简体   繁体   English

Elasticsearch-不使用Logstash或滚动API重新索引数据的最佳方法是什么?

[英]Elasticsearch - What is the best way to reindex my data without using Logstash or the scroll api?

I'm using Elasticsearch version 1.7.5. 我正在使用Elasticsearch版本1.7.5。 Before I can upgrade to version 2.x (or even 5.x), I need to reindex five large indices so that they conform to the 2.x standards. 在我可以升级到2.x版(甚至是5.x版)之前,我需要重新索引五个大索引,以使其符合2.x标准。

Unfortunately, Logstash (and the scroll api) can't reindex my data because of this problem . 不幸的是,由于这个问题 ,Logstash(和滚动api)无法为我的数据重新编制索引。


My Question: 我的问题:

  • What is the best way to reindex my data without using Logstash or the scroll api? 不使用Logstash或滚动API重新索引数据的最佳方法是什么?
    • If possible, I would prefer to use Nest. 如果可能的话,我宁愿使用Nest。

If you're targeting Elasticsearch 5.0+, you can use the reindex API to reindex data from a remote Elasticsearch cluster (the 1.7.5 cluster) into Elasticsearch 5.0+. 如果您以Elasticsearch 5.0+为目标,则可以使用reindex API将数据从远程Elasticsearch集群(1.7.5集群)重新索引到Elasticsearch 5.0+。

NEST 5.x exposes the reindex API as the ReindexOnServer() method NEST 5.x将重新索引API公开为ReindexOnServer()方法

client.ReindexOnServer(r => r
    .Source(s => s
        .Remote(sr => sr
            // URI to 1.7.5 cluster
            .Host(new Uri("http://localhost:9201"))
        )
        .Index("entries")
    )
    .Destination(d => d
        .Index("entries")
    )
    .WaitForCompletion(true)
);

WaitForCompletion determines whether the call should wait for reindex to finish. WaitForCompletion确定调用是否应等待重新索引完成。 If this is false, the Task property on the response can be used to check the status of the operation using the tasks API 如果为假,则可以使用任务API使用响应上的Task属性检查操作状态

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

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