-
Notifications
You must be signed in to change notification settings - Fork 1.2k
GetAsync fails when specifying a null index. #1980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you pull down foundatio repositories project and run the tests you'll run into this. |
You need to specify an index when getting a document. This exception is telling you exactly that. If it worked in 1.x then it was wrong :). |
If I pass null to the index that's the same as not specifying one.. They should work the same |
I feel pretty strongly that this is a bug in the client |
When you don't specify an index, it's being inferred from |
I get this but what use case would you ever pass null in here and get a valid query? |
And if you'd never get a valid query then, should we throw a argumentnullexception? This difference really threw me off guard. As a lot of tests started failing. |
Exactly. This is why we throw the exception when you pass it null. I get your point as well, but we try to generalize this logic for all API calls within |
The stack trace is terrible due to how its executed :( |
But
Is pretty descriptive :) |
Yes, it's much better than what it is but kinda of misleading until your used to all the new stack traces. I was expecting a request to be made and failed so I was looking in fiddler first ready to grab the request json. |
Gotcha. Going to close this. Please do keep opening issues though as you run into things. 👍 |
@niemyjski I stand corrected here :) Discussed this further with @Mpdreamz and @russcam and it makes sense for |
```csharp var response = await elasticClient.GetAsync<T>(id, s => s.Index(null)); ``` Would not default index back to inferred type of T. This PR makes specifying null for required route values a noop For optional routevalues null still clears the routevalue so the following still works ```csharp c => c.Index(project, i => i.Id(null)) ``` will reset the id on and send the index request to `/inferredindex/inferredtype`
…lues fix #1980 GetAsync fails when specifying a null index.
Closed via #2030 |
```csharp var response = await elasticClient.GetAsync<T>(id, s => s.Index(null)); ``` Would not default index back to inferred type of T. This PR makes specifying null for required route values a noop For optional routevalues null still clears the routevalue so the following still works ```csharp c => c.Index(project, i => i.Id(null)) ``` will reset the id on and send the index request to `/inferredindex/inferredtype`
```csharp var response = await elasticClient.GetAsync<T>(id, s => s.Index(null)); ``` Would not default index back to inferred type of T. This PR makes specifying null for required route values a noop For optional routevalues null still clears the routevalue so the following still works ```csharp c => c.Index(project, i => i.Id(null)) ``` will reset the id on and send the index request to `/inferredindex/inferredtype`
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:
Works:
The text was updated successfully, but these errors were encountered: