Using the C# Nest Client for ElasticSearch, Using GetAsync, how to determine if the document isn't found vs. significant error

Viewed 11

I'm using the C# Nest Client 7.17.4 and calling GetAsync():

var response = await _elasticClient.GetAsync<T?>("21c6a8ad-d173-4954-8729-d2493a944e58", s => s.Index("my_index")); 

If this document isn't found, response.IsValid is false as well as response.Found.

If there is a problematic issue with my method, i.e.; the Index doesn't exist or I can't reach ElasticSearch, the response is the same. Both response.IsValid and response.Found are false. Is there a way to determine the difference between a document not being found and a significant error?

0 Answers
Related