yii\elasticsearch\Query::addAgg PHP Method

addAgg() public method

See also: http://www.elastic.co/guide/en/elasticsearch/reference/1.x/search-aggregations.html
Deprecation: since 2.0.5 use addAggragate() instead Adds an aggregation to this query. This is an alias for [[addAggregation]].
public addAgg ( string $name, string $type, string | array $options )
$name string the name of the aggregation
$type string the aggregation type. e.g. `terms`, `range`, `histogram`...
$options string | array the configuration options for this aggregation. Can be an array or a json string.
    public function addAgg($name, $type, $options)
    {
        return $this->addAggregate($name, [$type => $options]);
    }