How to create a document using the .NET library?

Hello, I am trying to create a document using the .NET library.

Here is the code that I attempted

           var newLogResponse = await elasticClient.CreateAsync(new ElasticJobLog()
            {
                CreatedAt = endSearchTime,
                JobName = _jobName,
                Source = _source,
                Success = true,
            }, p=> p.Index("name_of_my_index"));

But, the above code throws the following error

Error Message: No route taking 1 parameters{index}/_create/{id} 

Here is the stack trace

Stack Trace:    at Nest.ApiUrls.Resolve(RouteValues routeValues, IConnectionSettingsValues settings)
   at Nest.RequestBase`1.ResolveUrl(RouteValues routeValues, IConnectionSettingsValues settings)
   at Nest.RequestBase`1.Nest.IRequest.GetUrl(IConnectionSettingsValues settings)
   at Nest.ElasticClient.DoRequestAsync[TRequest,TResponse](TRequest p, IRequestParameters parameters, CancellationToken ct, Action`1 forceConfiguration)
   at Nest.ElasticClient.CreateAsync[TDocument](ICreateRequest`1 request, CancellationToken ct)
   at Nest.ElasticClient.CreateAsync[TDocument](TDocument document, Func`2 selector, CancellationToken ct)

How can I fix this issue?

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