ruflin / Elastica

Elastica is a PHP client for elasticsearch
http://elastica.io/
MIT License
2.26k stars 734 forks source link

getErrorMessage logs "{$path} caused Array" to elasticsearch.log file #1335

Open ryan-mchale opened 7 years ago

ryan-mchale commented 7 years ago

I encountered this while debugging why some of my documents were not being indexed. When I checked the log/elasticsearch.log file, I found ~12000 of my documents had been logged with the following error:

index: /wa_default_idx1/product/127234 caused Array

This made debugging extremely difficult as the result of \Elastica\Bulk\Response::getError() is an array not a string. So I changed line 61 of \Elastica\Exception\Bulk\Response\ActionException::getErrorMessage() to the following:

$message = "$opType: $path caused " . print_r($error, true);

... so that I could receive the actual error message. This is likely a problem in other places, such as \Elastica\Bulk\ResponseSet::getError().

ruflin commented 7 years ago

Which version of Elasitca are you using with which version of elasticsearch?

ryan-mchale commented 7 years ago

Elasticsearch version 2.0.

Elastica came with a Magento module for Elasticsearch made by Bubble. Looking through the actual Elastica files though I can't find a version number anywhere. The version of the Bubble module is 4.1.2.

ruflin commented 7 years ago

The reasons I'm asking is because this is a change which was made in ES. So if you use the wrong version of Elastica with elasticsearch, you will see the above error. I assume they are using an older version of Elastica.