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.Successreturnsfalse -
response.TryGetServerError()returnstrue -
response.OriginalExceptioncontain the exception
-
-
Elasticsearch.Net 6.8.3:
-
response.Successreturnstrue -
response.TryGetServerError()returnsfalse -
response.OriginalExceptioncontains the exception
-
-
Elasticsearch.Net 7.4.0
-
response.Successreturnstrue -
response.TryGetServerError()returnsfalse -
response.OriginalExceptionis 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.