1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Enhanced Search Resolved Bugs' started by thedude, Sep 4, 2015.

  1. thedude

    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: Sep 4, 2015
  2. Mike

    Mike XenForo Developer Staff Member

    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.
     
    thedude likes this.

Share This Page