elasticsearch-net icon indicating copy to clipboard operation
elasticsearch-net copied to clipboard

Option to override default NEST high-level client behavior for 404 status codes

Open yevhen opened this issue 3 years ago • 1 comments

In our code, we heavily rely on ElasticClientException being thrown for requests made to missing documents/indices. While upgrading to 7.x we figured out that we need substantial changes to be made in too many places. Moreover, the previous behavior was easy to use with higher-order functions - you just catch ElasticClientException in top-level code and you're done. With new behavior, we need to augment low-level code everywhere to check for ResponseBase.IsValid property at the point of invocation which makes it non-composable and leads to ugly and verbose code (ala Go err checking).

Please, provide a global option for NEST high-level client, so that it doesn't override StatusCodeToResponseSuccess for 404 status codes.

yevhen avatar Jun 29 '21 09:06 yevhen

Hi @yevhen. Apologies for my delay in responding. I read this and thought I had left a note. I can see the benefit of this, particularly for upgrade scenarios as you have indicated. I'll need to spend some more time reviewing the finer details.

stevejgordon avatar Aug 16 '21 12:08 stevejgordon