Skip to content

ElasticSearch.Net.Exceptions.MaxRetryException hides server error #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
crunchie84 opened this issue Apr 28, 2014 · 4 comments
Closed
Milestone

Comments

@crunchie84
Copy link

When using Nest 1.0-beta1 + ES 1.1.1 the MaxRetryException gives no usefull information.

The query which we used resulted in a SearchPhaseExecutionException because it was buggy. It took more time then was needed to diagnose because we got MaxRetryExceptions in our logs instead of the underlying exception message from the server.

Expected result: Append server error into MaxRetryException as InnerException.

@Mpdreamz
Copy link
Member

hmm this should already be the case, will double check.

@Mpdreamz
Copy link
Member

Ahh, SearchPhraseExecution is a server exception and this won't be set as InnerException.

@Mpdreamz Mpdreamz added this to the NEST 1.0-beta2 milestone May 5, 2014
@Mpdreamz Mpdreamz added the Bug label May 5, 2014
@Mpdreamz
Copy link
Member

Mpdreamz commented May 6, 2014

It will now throw an ElasticsearchServerException which has an ExceptionType and Error property.

In your case ExceptionType would be SearchPhaseExecutionException

By default NEST follows a more c/go like error checking pattern with

var result = call();
if (result.IsValid) result.OriginalException; //this holds a ElasticsearchServerException now;

You can configure NEST to always throw a real exception in this case like so:

var settings = new ConnectionSettings().ThrowOnElasticsearchServerExceptions();

Or Elasticsearch.Net

var settings = new ConnectionConfiguration().ThrowOnElasticsearchServerExceptions();

I'm still debating whether the default should be throw or not (I still want to support both patterns) any input on this is welcome :)

@crunchie84
Copy link
Author

I would expect that the default behaviour is based on what kind of exceptionType the server has raised. For instance:

  • Retrieving document by id but not found => null response (or IResponse isValid=false)
  • parsing of query failed => exception by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants