Closed wgh000 closed 5 years ago
Actually is not possible to Aggregate query per multiple columns related.
Aggregate
The code:
query.Aggregate("country", reindexer.AggFacet).Aggregate("city", reindexer.AggFacet)
is returning 2 slices
slice[0] = {"country1": 10, "country2": 20} slice[1] = {"city1": 5, "city2": 20, "city3": 5}
It will be good to have a full aggregations, like MySql GROUP BY, returning
GROUP BY
slice[0] = {["country": "country1", "city": "city1", "count": 10], ...}
Someone proposed to use the following construct
query.Aggregate("CONCAT(country, city)", reindexer.AggFacet)
This feature is available in new reindexer version. Check updated documentation: https://github.com/Restream/reindexer/blob/master/readme.md#aggregations
Actually is not possible to
Aggregate
query per multiple columns related.The code:
is returning 2 slices
It will be good to have a full aggregations, like MySql
GROUP BY
, returningSomeone proposed to use the following construct