MoreLikeThis ignores queries?

(Alexey Bagryancev) #1


I am trying to filter moreLikeThis results by adding additional query - but
it seems to ignore it at all.

I tried to run my ignoreQuery separately and it works fine, but how to make
it work with moreLikeThis? Please help me.

$ignoreQuery = $this->IgnoreCategoryQuery('movies')

$this->resultsSet = $this->index->moreLikeThis(new \Elastica\Document($id),
array_merge($this->mlt_fields, array('search_size' => $this->size,
'search_from' => $this->from, 'min_doc_freq' => 2, 'min_term_freq' => 1,
'min_word_length' => 3)), $ignoreQuery);

My IgnoreCategory function:

public function IgnoreCategoryQuery($category = 'main')
$categoriesTermQuery = new \Elastica\Query\Term();
$categoriesTermQuery->setTerm('categories', $category);
$categoriesBoolQuery = new \Elastica\Query\Bool();
return $categoriesBoolQuery;

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit

(system) #2