Is there any way to update documents using the ingest pipeline?

We are using NEST and using the Ingest Pipeline when indexing a new document as follows:

await ElasticSearchConfig.GetClient().IndexAsync(o, idx => idx.Index($"{index}-{user.Country.ToLower()}").Pipeline("agent-pipeline"));

But we cannot find a way of using the Pipline when updating a document such as:

await ElasticSearchConfig.GetClient().UpdateAsync<object>(user.Id, u => u

.Index($"{index}-{user.ToLower()}")
.Doc(o)
.Refresh(Elasticsearch.Net.Refresh.True)
);

Also, does one need to delete the Pipeline when finished?

Would appreciate any assistance.

Hi @xef,

as far as I can tell, the pipeline parameter is only supported for index, reindex and update_by_query, but not for regular update (documentation).

Since you seem to pass the whole document to your update call anyways, you could replace that with a second IndexAsync call which will have the same effect.

Also, does one need to delete the Pipeline when finished?

This depends on your use-case. I would say in most cases you want the pipeline to persist.

We are using NEST

I would highly recommend updating to the new client Elastic.Clients.Elasticsearch since NEST will be end of life at the end of this year.