In Elasticsearch.Net 7.4.0 when searching an index or alias which does not exist (HttpStatusCode:404), what is the correct way to resolve the index_not_found_exception
which is emitted by the server?
-
Elasticsearch.Net 6.3.1:
-
response.Success
returnsfalse
-
response.TryGetServerError()
returnstrue
-
response.OriginalException
contain the exception
-
-
Elasticsearch.Net 6.8.3:
-
response.Success
returnstrue
-
response.TryGetServerError()
returnsfalse
-
response.OriginalException
contains the exception
-
-
Elasticsearch.Net 7.4.0
-
response.Success
returnstrue
-
response.TryGetServerError()
returnsfalse
-
response.OriginalException
is null
-
In all three client versions accessing response.Body
yields the raw server response with an index_not_found_exception, but in ES 7.4.0 there is no public indication that there was a server exception and the only way to return the error is to access the raw response.
When using the NEST 7.4.0 client for the same operation response.TryGetServerErrorReason()
returns the index_not_found_exception. This discrepancy is very confusing.