yii\elasticsearch\Query::addAggregate PHP Method

addAggregate() public method

Adds an aggregation to this query. Supports nested aggregations.
See also: https://www.elastic.co/guide/en/elasticsearch/reference/2.3/search-aggregations.html
public addAggregate ( string $name, string | array $options )
$name string the name of the aggregation
$options string | array the configuration options for this aggregation. Can be an array or a json string.
    public function addAggregate($name, $options)
    {
        $this->aggregations[$name] = $options;
        return $this;
    }