Fixed isIndexSuccessful() not checking ES response correctly on bulk inserts?

thedude

Well-known member
XenES 1.1.2

When doing a bulk insert in ES, a response containing "errors": false means all subrequests completed successfully (ElasticSearch reference on bulk insert response).

XenES_Search_SourceHandler_ElasticSearch::isIndexSuccessful contains
Code:
if (isset($result->errors) && !$result->errors)
{
return false;
}
meaning isIndexSuccessful checks if an "errors" value was set, but then declares it unsuccessful (by returning false) if "errors" is set to false, when it should be declared unsuccessful if "errors" is set to true.

XenES_Search_SourceHandler_ElasticSearch::_triggerFailedIndexError compensates for this with
Code:
else
{
// no error
return;
}
 
Last edited:
I'm not sure why the logic was done like that. It was changed for some API changes with Elasticsearch 1.0/1.1, but it does look backwards, so I've changed it as well.
 
Back
Top Bottom