$script = '
def value = \'\';
' .
implode(' ',
$fields) . '
return value;
';
$aggregation =
new CardinalityAggregation('total-count'
);
$aggregation->
setScript($script);
return $this->
addPostFilterAggregation($criteria,
$definition,
$context,
$aggregation);
} private function addPostFilterAggregation(Criteria
$criteria, EntityDefinition
$definition, Context
$context, CardinalityAggregation
$aggregation): AbstractAggregation
{ if (!
$criteria->
getPostFilters()) { return $aggregation;
} $query =
$this->criteriaParser->
parseFilter(