6.x sets IsValid=false for 404 response
See original GitHub issueNEST: 6.x > Client: 6.x >
We are updating from 5.6 to 6.6 and have found that GetAsync sets IsValid=false when the document is not found. This is change from 5.6 where IsValid=true and Found=false. This is on .NET Core.
var response = await client.GetAsync (new DocumentPath<Person>("invalid"));
Response data:
IsValid: false
Found: false
DebugInformation: Invalid NEST response built from a unsuccessful low level call on GET: /people/person/invalid Audit trail of this API call: [1] BadResponse: Node: http://127.0.0.1:9200/ Took: 00:00:00.1815146 OriginalException: Elasticsearch.Net.ElasticsearchClientException: The remote server returned an error: (404) Not Found
I can’t find any information stating this change. And can’t see how the exception could be used to infer it’s valid but not found without doing something like if(response.DebugInformation.Contains(“(404) Not Found”)) which is not ideal.
Please advise if this is expected behaviour. Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Yeah, I noticed this too and it seems wrong to me. 404 is a perfectly valid response for missing documents.
Closing this ticket, hopefully @Mpdreamz has advised sufficiently as to the expected behaviour in
.6.x
. The two PRs mentioned have been merged into7.x
and will be available on the next release. Thanks @keithpecka3 - any problems please open another issue.