I use ElasticsearchClient for .NET from Elastic.Clients.Elasticsearch 8.9.3 library. Trying to create a new document with the following code:
var createRequest = new CreateRequest<MyModelDto>("myindex", Id.From(dto))
{
Document = dto
};
await _client.CreateAsync(createRequest);
But it results to the following exception:
System.Exception: No route taking 1 parameters{index}/create/{id}
at Elastic.Clients.Elasticsearch.Requests.ApiUrls.Resolve(RouteValues routeValues, IElasticsearchClientSettings settings) in //src/Elastic.Clients.Elasticsearch/Core/Request/ApiUrls.cs:line 68
at Elastic.Clients.Elasticsearch.Requests.Request.ResolveUrl(RouteValues routeValues, IElasticsearchClientSettings settings) in //src/Elastic.Clients.Elasticsearch/Core/Request/Request.cs:line 52
at Elastic.Clients.Elasticsearch.Requests.Request.GetUrl(IElasticsearchClientSettings settings) in //src/Elastic.Clients.Elasticsearch/Core/Request/Request.cs:line 56
at Elastic.Clients.Elasticsearch.ElasticsearchClient.PrepareRequest[TRequest,TRequestParameters](TRequest request, Action1 forceConfiguration) in /_/src/Elastic.Clients.Elasticsearch/Client/ElasticsearchClient.cs:line 279 at Elastic.Clients.Elasticsearch.ElasticsearchClient.DoRequestAsync[TRequest,TResponse,TRequestParameters](TRequest request, Action
1 forceConfiguration, CancellationToken cancellationToken) in //src/Elastic.Clients.Elasticsearch/Client/ElasticsearchClient.cs:line 221 at Elastic.Clients.Elasticsearch.ElasticsearchClient.DoRequestAsync[TRequest,TResponse,TRequestParameters](TRequest request, CancellationToken cancellationToken) in //src/Elastic.Clients.Elasticsearch/Client/ElasticsearchClient.cs:line 179 at Elastic.Clients.Elasticsearch.ElasticsearchClient.CreateAsync[TDocument](CreateRequest`1 request, CancellationToken cancellationToken) in /_/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.g.cs:line 483
What is wrong here? Thanks.