I'm using the latest .NET client for elasticsearch.
The docs shows this as an example of how to index documents: Getting started | Elasticsearch .NET Client [8.9] | Elastic
When writing the same code in VS Community 2022 17.9.7 as well as VS Code it shows an error that the call is ambiguous:
Pasting the error here as well for searchability.
error CS0121: The call is ambiguous between the following methods or properties: 'ElasticsearchClient.IndexAsync(TDocument, IndexName, CancellationToken)' and 'ElasticsearchClient.IndexAsync(TDocument, Id?, CancellationToken)'
Is casting the string the correct way to index documents now? If so I'd love to see the documentation updated to reflect the recent changes to the .NET client.
var response = await _esClient.IndexAsync(doc, (IndexName)"my_index");
Edit:
My post was flagged as spam for being overly promotional. What is promotional? I don't see why this would be flagged, as it may help future people with the same question find the answer without posting their own question.