Skip to content
Snippets Groups Projects
Commit 57cea2aa authored by Aivaras Gotovskis's avatar Aivaras Gotovskis
Browse files

Add nested aggregation doc.

parent b949baa9
No related branches found
No related tags found
No related merge requests found
# Nested Aggregation
> More info about nested aggregation is in the [official elasticsearch docs][1]
A special single bucket aggregation that enables aggregating nested documents.
## Simple example
```JSON
{
"aggregations" : {
"agg_resellers" : {
"nested" : {
"path" : "resellers"
},
"aggregations" : {
"agg_min_price" : { "min" : { "field" : "resellers.price" } }
}
}
}
}
```
And now the query via DSL:
```php
$minAggregation = new MinAggregation('min_price', 'resellers.price');
$nestedAggregation = new NestedAggregation('resellers', 'resellers');
$nestedAggregation->addAggregation($minAggregation);
$search = new Search();
$search->addAggregation($nestedAggregation);
$queryArray = $search->toArray();
```
[1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-nested-aggregation.html
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment