Reputation: 423
I am upgrading my NEST version from 6.8 to 7.1. Since it is major version upgrade, I am experiencing some breaking changes.
One of the breaking change is with Reindex API. Earlier in NEST 6.8, I used to reindex like this:
var req = new JObject
{
{ "source", new JObject
{
{ "index", "sourceIndexName" }
}
},
{ "dest", new JObject
{
{ "index", "destIndexName" }
}
}
};
var postDataRequest = JsonConvert.SerializeObject(jsonReindexReq, defaultJsonSerializerSettings);
var response = await elasticSearchClient.LowLevel.ReindexAsync<StringResponse>(postDataRequest, null, cancellationToken);
How would I be able to do it now using NEST 7.1?
I see there are 14 different flavors of reindex apis present in the new SDK, but I am not able to find any example online.
Upvotes: 1
Views: 544
Reputation: 1770
There is several constructors, you could have cancellationToken or some other stuff.
The query should be:
var reindexResponse = client.ReindexOnServer(r => r
.Source(sou => sou.Index("sourceindex"))
.Destination(des => des.Index("destindex"))
.WaitForCompletion(true)
);
Upvotes: 2