Handling index_not_found_exception in Elasticsearch.Net 7.4.0

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 returns false
    • response.TryGetServerError() returns true
    • response.OriginalException contain the exception
  • Elasticsearch.Net 6.8.3:
    • response.Success returns true
    • response.TryGetServerError() returns false
    • response.OriginalException contains the exception
  • Elasticsearch.Net 7.4.0
    • response.Success returns true
    • response.TryGetServerError() returns false
    • 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.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.