GetAsync fails when specifying a null index.
See original GitHub issueWe 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);
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
GetAsync returns null when used in other tests
I'm new to C# and .NET, and when writing a test using SpecFlow, I get the error System.NullReferenceException: Object reference not set to...
Read more >Get Index API | Java REST Client [7.17]
Users need to specify how the response or potential failures will be handled by passing the request and a listener to the asynchronous...
Read more >null_value | Elasticsearch Guide [8.9]
The null_value parameter allows you to replace explicit null values with the specified value so that it can be indexed and searched. For...
Read more >Advanced query capabilities on Azure AD objects
For directory objects, $search works only in advanced queries. If the ConsistencyLevel header is not specified, the request returns an error.
Read more >Troubleshoot Dataverse plug-ins - Power Apps
To solve this error, you must check that the key exists before attempting to use it to access a value. For example, when...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@niemyjski I stand corrected here 😃
Discussed this further with @Mpdreamz and @russcam and it makes sense for
.Index(null)
to behave as if it was never called. This is a general rule the fluent API should follow everywhere.Closed via #2030