简体   繁体   中英

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

Unfortunately, Logstash (and the scroll api) can't reindex my data because of this problem .


My Question:

  • What is the best way to reindex my data without using Logstash or the scroll api?
    • If possible, I would prefer to use 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+.

NEST 5.x exposes the reindex API as the ReindexOnServer() method

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. If this is false, the Task property on the response can be used to check the status of the operation using the tasks API

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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