Skip to content

GetAsync fails when specifying a null index. #1980

Closed
@niemyjski

Description

@niemyjski

We have some generic code that runs and trys to specify an index for getbyid but if it can't be found it returns null. This worked in <2.0 of the client I believe this is a bug.

Fails:

var response = await elasticClient.GetAsync<T>(id, s => s.Index(null));


System.ArgumentException

Dispatching Get() from NEST into to Elasticsearch.NET failed
Received a request marked as GET
This endpoint accepts GET
The request might not have enough information provided to make any of these endpoints:
  - /{index=<NULL>}/{type=employee}/{id=56fed5baae14593188842ee5}


   at Nest.LowLevelDispatch.GetDispatchAsync[T](IRequest`1 p) in C:\users\russ\source\elasticsearch-net\src\Nest\_Generated\_LowLevelDispatch.generated.cs:line 932
   at Nest.ElasticClient.<Nest-IHighLevelToLowLevelDispatcher-DispatchAsync>d__24`4.MoveNext() in C:\users\russ\source\elasticsearch-net\src\Nest\ElasticClient.cs:line 75
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Foundatio.Elasticsearch.Repositories.ElasticReadOnlyRepositoryBase`1.<GetByIdAsync>d__15.MoveNext() in C:\Code\Foundatio.Repositories\src\Elasticsearch\Repositories\ElasticReadOnlyRepositoryBase.cs:line 196

Works:

var response = await elasticClient.GetAsync<T>(id);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions