Return additional fields in aggregation


(DM) #1

When I do aggregation can I return additional fields (e.g. payload like in suggestion) with the one I'm aggregating by?

For example, I aggregate my items by brand name to show a customer how many items of each brand we have in his request. However I want to also provide a slug for each brand I have listed in the aggregation in order to provide ability to customer to click on the link of that brand.

Currently I use a 'combined' field to achieve that in aggregation and it looks like this: 'brand_name|brand-slug'. So when I aggregate by the 'combined' field I have to do and extra script to separate brand_name from brand-slug.

Is there any non-hacky way to achieve that?


(system) #2