# Bucket Aggregation on multiple document types

**URL:** <https://discuss.elastic.co/t/bucket-aggregation-on-multiple-document-types/33081>\
**Category:** Elasticsearch\
**Created:** [October 27, 2015, 2:02pm UTC](https://discuss.elastic.co/t/bucket-aggregation-on-multiple-document-types/33081 "2015-10-27T14:02:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramanareddy438](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@ramanareddy438](https://discuss.elastic.co/u/ramanareddy438)\
**Post date:** [October 27, 2015, 2:02pm UTC](https://discuss.elastic.co/t/bucket-aggregation-on-multiple-document-types/33081/1 "2015-10-27T14:02:09Z")

</div>

Hi there,

I am a newbie to elasticsearch.

I have two different document types such as account and invoice. Account document is having country information. I am able to bucket aggregate account documents based on country. Now I want to bucket aggregate invoice documents based on the account name. This whole thing should be in a single aggregation. Please let me know if more information is needed.

accounts - categorize by country  
invoice - categorize by invoice

Thank you in advance for the help.

Regards  
Ramana Reddy

---

<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:42pm UTC](https://discuss.elastic.co/t/bucket-aggregation-on-multiple-document-types/33081/2 "2017-07-05T23:42:25Z")

</div>

Closed on July 5, 2017, 11:42pm UTC


