elasticsearch
elasticsearch copied to clipboard
Error reporting is broken
The HTTP transport will always return ["error" => "", "code" => 0]
in case of network error. This makes debugging difficult.
At line 207 below, we check if $response is false, but it's always a string. In case of network error, it will be the empty string, json_decode() fails, and ["error" => "", "code" => 0]
is returned.
https://github.com/nervetattoo/elasticsearch/blob/d033461b1baf8eaa5f5c18bd0fb21927e02ce03c/src/ElasticSearch/Transport/HTTP.php#L205-L213
Using curl_geterrno() === 0
instead of $response !== false
fixes the problem.