question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GetAsync fails when specifying a null index.

See original GitHub issue

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);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
gmarzcommented, Apr 4, 2016

@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.

0reactions
gmarzcommented, Apr 12, 2016

Closed via #2030

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found