0

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.
Jim G.
  • 15,141
  • 22
  • 103
  • 166
  • this answer might help: https://stackoverflow.com/questions/34921637/how-to-copy-one-index-documents-to-other-index-in-elasticsearch/34922623#34922623 – Val Jul 18 '17 at 15:13
  • @Val: Thanks. Unfortunately, all of those solutions use the scroll api. – Jim G. Jul 18 '17 at 15:28
  • Would [this doc](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/reindex-upgrade.html) helps? – Adonis Jul 18 '17 at 19:26

1 Answers1

1

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

Russ Cam
  • 124,184
  • 33
  • 204
  • 266