# Return additional fields in aggregation

**URL:** <https://discuss.elastic.co/t/return-additional-fields-in-aggregation/32288>\
**Category:** Elasticsearch\
**Created:** [October 15, 2015, 2:49pm UTC](https://discuss.elastic.co/t/return-additional-fields-in-aggregation/32288 "2015-10-15T14:49:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmit](https://avatars.discourse-cdn.com/v4/letter/d/f1d935/32.png) [@dmit](https://discuss.elastic.co/u/dmit)\
**Post date:** [October 15, 2015, 2:49pm UTC](https://discuss.elastic.co/t/return-additional-fields-in-aggregation/32288/1 "2015-10-15T14:49:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:44pm UTC](https://discuss.elastic.co/t/return-additional-fields-in-aggregation/32288/2 "2017-07-05T23:44:35Z")

</div>


