-
Aivaras Gotovskis authoredAivaras Gotovskis authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Histogram.md 849 B
Histogram Aggregation
More info about histogram aggregation is in the official elasticsearch docs
A multi-bucket values source based aggregation that can be applied on numeric values extracted from the documents. It dynamically builds fixed size (a.k.a. interval) buckets over the values.
Simple example
{
"aggregations": {
"agg_prices": {
"histogram": {
"field": "price",
"interval": 50
}
}
}
}
And now the query via DSL:
$histogramAggregation = new HistogramAggregation('prices', 'price', 50);
$search = new Search();
$search->addAggregation($histogramAggregation);
$queryArray = $search->toArray();