1

So I kick off reindexing on the ElasticSearch server:

// Start reindexing on the server
var response = client.ReindexOnServer(new ReindexOnServerRequest()
{
  Source = new ReindexSource() { Index = metadataModel.SourceIndexName },
  Destination = new ReindexDestination() {  Index = metadataModel.DestinationIndexName, OpType = Elasticsearch.Net.OpType.Create },
  WaitForCompletion = false,
  Refresh = true
});

var elasticSearchReIndexTaskId = response.Task.ToString();

and I got back the task ID. How can I use the Task API to track the progress of that task?

If the task is complete, would that error out or return something?

var response = client.TasksList(new TasksListRequest(elasticSearchTaskId));
hyankov
  • 4,049
  • 1
  • 29
  • 46
  • You can pass the `TaskId` to `GetTask(...)`, which contains a `Completed` property on the response to know if the task has completed. This maps to https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html – Russ Cam Mar 27 '18 at 04:25
  • Interesting, there is no `GetTask(...)` in the version I am using – hyankov Mar 27 '18 at 13:41
  • Which version of NEST are you using? And which version of Elasticsearch are you targeting? – Russ Cam Mar 27 '18 at 21:42
  • Nest 2.0, ES 2.4.2 – hyankov Mar 29 '18 at 02:49
  • which nuget package version of NEST 2.x? – Russ Cam Mar 29 '18 at 02:50
  • Have you got the way to track to status of reindexing? I hope you are using C# Nest library for elastic. – ketan27j Feb 27 '20 at 07:16
  • Nope, I never found a way in v2 or v5. I am waiting for the task to disappear from list of tasks and then after a "cool-off" (when doc count stops increment in the dest. index) I compare the number of documents. – hyankov Feb 27 '20 at 17:52

0 Answers0