# Handling index\_not\_found\_exception in Elasticsearch.Net 7.4.0

**URL:** <https://discuss.elastic.co/t/handling-index-not-found-exception-in-elasticsearch-net-7-4-0/207773>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [November 13, 2019, 8:23pm UTC](https://discuss.elastic.co/t/handling-index-not-found-exception-in-elasticsearch-net-7-4-0/207773 "2019-11-13T20:23:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lakario](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lakario/32/57631_2.png) [@lakario](https://discuss.elastic.co/u/lakario)\
**Post date:** [November 13, 2019, 8:23pm UTC](https://discuss.elastic.co/t/handling-index-not-found-exception-in-elasticsearch-net-7-4-0/207773/1 "2019-11-13T20:23:41Z")

</div>

In [Elasticsearch.Net](http://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](http://Elasticsearch.Net) 6.3.1:
  - `response.Success` returns `false`
  - `response.TryGetServerError()` returns `true`
  - `response.OriginalException` contain the exception

- [Elasticsearch.Net](http://Elasticsearch.Net) 6.8.3:
  - `response.Success` returns `true`
  - `response.TryGetServerError()` returns `false`
  - `response.OriginalException` contains the exception

- [Elasticsearch.Net](http://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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 11, 2019, 8:23pm UTC](https://discuss.elastic.co/t/handling-index-not-found-exception-in-elasticsearch-net-7-4-0/207773/2 "2019-12-11T20:23:48Z")

</div>

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