-
Aivaras Gotovskis authoredAivaras Gotovskis authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
index.md 1.43 KiB
Aggregation
Objective aggregation builder represents all available Elasticsearch aggregations.
To form an aggregation you have to create Search
object. See below an example of min aggregation usage.
$search = new Search();
$minAggregation = new MinAggregation('min_agg');
$minAggregation->setField('price');
$search->addAggregation($minAggregation);
$queryArray = $search->toArray();
There are 2 types of aggregation: bucketing and metric. The only difference in using them is that metric bucketing aggregations supports nesting while metric aggregations will ignore any set nested aggregations.