This is working fine with elasticsearch 0.90.9+, however as expected, it
does not work with 0.90.7. This is all logical since it is something that
is introduced in 0.90.9. The problem is the error handling. In the response
I get the following message:

The response using the javascript driver (in the browser) is a
ConnectionFailure. I would like to obtain the message
"QueryParsingException[[kibana-int] No query registered for
[simple_query_string]]" out of this, that would really help. This is doable
using the elasticsearch logs but I cannot present this message using
javascript to the client.

Forgot to mention to reproduce in the plugin, go to the search tab, enter a
term to search on and press the search button. You won't see a problem in
the screen, but you will see errors in the console. The messages I have
shown were obtained using charles (a proxy).

Op zondag 12 januari 2014 15:51:29 UTC+1 schreef Jettro Coenradie:

Hi,
I am trying out the elasticsearch javascript connection driver. It is
working fine, but I am facing a problem with the error handling. To me it
seems to be an elasticsearch rest api problem.

This is working fine with elasticsearch 0.90.9+, however as expected, it
does not work with 0.90.7. This is all logical since it is something that
is introduced in 0.90.9. The problem is the error handling. In the response
I get the following message:

The response using the javascript driver (in the browser) is a
ConnectionFailure. I would like to obtain the message
"QueryParsingException[[kibana-int] No query registered for
[simple_query_string]]" out of this, that would really help. This is doable
using the elasticsearch logs but I cannot present this message using
javascript to the client.

The reason why you receive a SearchPhaseExecutionException and many
SearchParseExceptions is that your query is parsed at each shard and causes
an error at that deeper level. ES wraps up the shards responses into a
SearchPhaseExecutionException
which is passed back to the client.

In most cases, all shards respond with same errors, but that is not always
the case.

This certainly can be improved regarding the JSON formatting by a patch to
ES so the REST action tries to parse error response from shards.

Another possibility would be processing the shards exceptions and just
returning a short SearchPhaseExecutionException message saying something
like "no query registered for ..." if all shard errors match.

In general, I would simply rely on the REST response codes (here: 400)
which signals "bad request" and ignore the ES error messages since they are
fluctuating.