EntityDefinition
$definition,
array
$rows,
Context
$context ): AggregationResult
{ $name =
$aggregation->
getName();
switch (true
) { case $aggregation instanceof DateHistogramAggregation:
return $this->
hydrateDateHistogramAggregation($aggregation,
$definition,
$rows,
$context);
case $aggregation instanceof TermsAggregation:
return $this->
hydrateTermsAggregation($aggregation,
$definition,
$rows,
$context);
case $aggregation instanceof FilterAggregation:
$aggregationStruct =
$aggregation->
getAggregation();
\
assert($aggregationStruct !== null, 'FilterAggregation always have an aggregation'
);
return $this->
hydrateResult($aggregationStruct,
$definition,
$rows,
$context);
case $aggregation instanceof AvgAggregation:
$value =
isset($rows[0
]) ?
$rows[0
][$name] : 0;
return new AvgResult($aggregation->
getName(),
(float) $value);