Using new elasticsearch client 8.0.8, creating a index , add a record and update the existing record

I am using client 8.0.8 Elastic.Clients.Elasticsearch to create index, add a record and update the existing record to the index.

What is the appropriate method to add and update the index.

Here is the code snippet I used to add and update, but the below snippet always add a record.

     var response = elasticsearchClient.BulkAll(overpaymentSearchData,
            b => b.Index(ConfigIndexKeys.OverpaymentIndex)
            .BackOffTime("30s")
            .BackOffRetries(3)
            .RefreshOnCompleted()
            .MaxDegreeOfParallelism(10)
            .Size(500))
            .Wait(TimeSpan.FromMinutes(5), next =>
            { }
            );

I do not use this client, but it does not seem like you are specifying a document ID. This is how Elasticsearch identifies a document and if you do not specify it, a new document with an ID generated by Elasticsearch will always be generated.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.