Cake\ElasticSearch\Query::aggregate PHP Method

aggregate() public method

Add an aggregation to the elastic query object
public aggregate ( array | AbstractAggregation $aggregation )
$aggregation array | Elastica\Aggregation\AbstractAggregation One or multiple facets
    public function aggregate($aggregation)
    {
        if (is_array($aggregation)) {
            foreach ($aggregation as $aggregationItem) {
                $this->aggregate($aggregationItem);
            }
        } else {
            $this->_parts['aggregations'][] = $aggregation;
        }
        return $this;
    }