So I've got a query. It makes a few filters and then add an aggregations.
...
$query->setFilter($bool)
...
$query->setFilter($bool)
...
$query->setFilter($bool)
$agg = new Elastica\Aggregation\Terms('agg_name');
$agg->setField('name');
$agg->setSize(0);
$query->addAggregation($agg);
$search->setQuery($query);
$resultSet = $search->search();
$aggregations = $resultSet->getAggregations();
var_dump($aggregations);
So the problem now is, whenI var_dump my $aggregations variable I find out that my query filters were not processed.
In other words the Terms aggregation correctly groups results by Name, but it does not group the QUERY results by name, rather they group ALL the names in my Elasticsearch index.
So rather than having a result as follow (the idea) :
Name : X, doc_count : 3
Name : Y, doc_count : 3
Well, I get all the names grouped :
Name : X, doc_count : 62
Name : Y, doc_count : 97
Name : Z, doc_count : 18
Name : A, doc_count : 36
Name : B, doc_count : 47
Name : C, doc_count : 81
Any idea why aren't my aggregations taking my filters into consideration?