if ($nested === null
) { throw new \
RuntimeException(sprintf('Nested filter aggregation %s can not be parsed.',
$aggregation->
getName()));
} // when aggregation inside the filter aggregation points to a nested object (e.g. product.properties.id) we have to add all filters
// which points to the same association to the same "nesting" level like the nested aggregation for this association
$path =
$nested instanceof NestedAggregation ?
$nested->
getPath() : null;
$bool =
new BoolQuery();
$filters =
[];
foreach ($aggregation->
getFilter() as $filter) { $query =
$this->
parseFilter($filter,
$definition,
$definition->
getEntityName(),
$context);
if (!
$query instanceof NestedQuery
) { $filters[] =
new Bucketing\
FilterAggregation($aggregation->
getName(),
$query);
continue;
} // same property path as the "real" aggregation
if ($query->
getPath() ===
$path) { $bool->
add($query->
getQuery());