1

I'm trying to add a boost to products in a certain category to be displayed first. Using the Smile extension found in app\code\community\Smile\ElasticSearch\Model\Resource\Engine\Elasticsearch\Query\Abstract.php where the ElasticSearch is built

protected function _assembleQuery()
{
     $query = array('index' => $this->getAdapter()->getCurrentIndex()->getCurrentName(), 'type' => $this->getType());
     $query['body']['query']['filtered']['query']['bool']['must'][] = $this->_prepareFulltextCondition();
     ...
}

I'm trying to add something like:

$query['body']['query']['should'] = [
    'match' => [
        'field' => 'categories',
        'query' => 'id_of_category',
        'boost' => 10,
    ]
 ];

But this is not working. Returning error:

{"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;... nested: ElasticsearchParseException[Expected field name but got START_OBJECT \"should\"]; 

Can someone help, please?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.