Replies: 2 comments
-
Directly on the If you need the aggregations to be part of your paginated dataset, you might be able to handle it already with one of the other adapters that have hook points (i.e. the callback or transforming adapters) or implement your own decorator around the |
Beta Was this translation helpful? Give feedback.
-
After some inspection of the inner live, I`ve discovered one easy option: $quantityAgg = new Aggregation\Sum('sum_quantity');
$quantityAgg->setField('quantity');
$query = (new Query())
->setQuery($yourQuery)
->addAggregation($quantityAgg)
; Then on return [
'agg' => [
'sum_quantity' => $resultSet->getAggregation('sum_quantity')['value'] ?? 0,
],
]; |
Beta Was this translation helpful? Give feedback.
-
I need to sum up a field on the ElasticaAdapter.
I am curious if it is possible to use aggregations with
ElasticaAdapter
?Or are there any plans to implement that in future?
Beta Was this translation helpful? Give feedback.
All reactions