# Can aggregation return the documents in each bucket?

**URL:** <https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443>\
**Category:** Elasticsearch\
**Created:** [March 19, 2014, 12:07am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443 "2014-03-19T00:07:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erich\_Lin](https://avatars.discourse-cdn.com/v4/letter/e/85e7bf/32.png) [@Erich\_Lin](https://discuss.elastic.co/u/Erich_Lin)\
**Post date:** [March 19, 2014, 12:07am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/1 "2014-03-19T00:07:40Z")

</div>

It seems aggregation will return the count of documents for each bucket.

Can I also retrieve the documents within each bucket that matched that  
bucket criteria?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [March 20, 2014, 10:25am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/2 "2014-03-20T10:25:55Z")

</div>

Hi,

Unfortunately, this is not possible, aggregations cannot return whole  
documents today.

On Wed, Mar 19, 2014 at 1:07 AM, Erich Lin [elin@onekingslane.com](mailto:elin@onekingslane.com) wrote:

> It seems aggregation will return the count of documents for each bucket.
> 
> Can I also retrieve the documents within each bucket that matched that  
> bucket criteria?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j54QLzGup4xTfjoYBf21vKd31g2OBBsjREYs0NuPfg3Ag%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j54QLzGup4xTfjoYBf21vKd31g2OBBsjREYs0NuPfg3Ag%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Pratikshya\_Kuinkel](https://avatars.discourse-cdn.com/v4/letter/p/eada6e/32.png) [@Pratikshya\_Kuinkel](https://discuss.elastic.co/u/Pratikshya_Kuinkel)\
**Post date:** [April 23, 2014, 6:37am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/3 "2014-04-23T06:37:13Z")

</div>

Is there any work around to this problem? How can I know which documents  
belonged to the bucket? Can it at least return id of the document?

On Thursday, March 20, 2014 9:25:55 PM UTC+11, Adrien Grand wrote:

> Hi,
> 
> Unfortunately, this is not possible, aggregations cannot return whole  
> documents today.
> 
> On Wed, Mar 19, 2014 at 1:07 AM, Erich Lin \<[el...@onekingslane.com](mailto:el...@onekingslane.com)\<javascript:\>
> 
> > wrote:
> 
> > It seems aggregation will return the count of documents for each bucket.
> > 
> > Can I also retrieve the documents within each bucket that matched that  
> > bucket criteria?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![sumit\_gupta\_sgt](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@sumit\_gupta\_sgt](https://discuss.elastic.co/u/sumit_gupta_sgt)\
**Post date:** [April 23, 2014, 7:26am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/4 "2014-04-23T07:26:58Z")

</div>

Hi,

if you want total number of document you can use \_all.

Thanks,  
Sumit

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [April 25, 2014, 10:27am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/5 "2014-04-25T10:27:28Z")

</div>

A work-around could be to run a terms aggregation on the \_uid field in  
order to get the uids back. But beware that this will require loading  
field data for the \_uid field, which can be quite expensive.

On Wed, Apr 23, 2014 at 8:37 AM, Pratikshya Kuinkel  
[prati.ekshya@gmail.com](mailto:prati.ekshya@gmail.com)wrote:

> Is there any work around to this problem? How can I know which documents  
> belonged to the bucket? Can it at least return id of the document?
> 
> On Thursday, March 20, 2014 9:25:55 PM UTC+11, Adrien Grand wrote:
> 
> > Hi,
> > 
> > Unfortunately, this is not possible, aggregations cannot return whole  
> > documents today.
> > 
> > On Wed, Mar 19, 2014 at 1:07 AM, Erich Lin [el...@onekingslane.com](mailto:el...@onekingslane.com)wrote:
> > 
> > > It seems aggregation will return the count of documents for each bucket.
> > > 
> > > Can I also retrieve the documents within each bucket that matched that  
> > > bucket criteria?
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%  
> > > [40googlegroups.com](http://40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Adrien Grand
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4dM2EsqegWDb64mMaaQbK%3DoFukXQqds4xwR2nHbRTSWA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j4dM2EsqegWDb64mMaaQbK%3DoFukXQqds4xwR2nHbRTSWA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Nicolas\_F](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_f/32/1239_2.png) [@Nicolas\_F](https://discuss.elastic.co/u/Nicolas_F)\
**Post date:** [October 2, 2014, 9:40am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/6 "2014-10-02T09:40:40Z")

</div>

Hi,

Is that limitation still true in versions 1.3.4 or 1.4.0?

Nicolas F

Le vendredi 25 avril 2014 12:27:28 UTC+2, Adrien Grand a écrit :

> A work-around could be to run a terms aggregation on the \_uid field in  
> order to get the uids back. But beware that this will require loading  
> field data for the \_uid field, which can be quite expensive.
> 
> On Wed, Apr 23, 2014 at 8:37 AM, Pratikshya Kuinkel \<[prati....@gmail.com](mailto:prati....@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > Is there any work around to this problem? How can I know which documents  
> > belonged to the bucket? Can it at least return id of the document?
> > 
> > On Thursday, March 20, 2014 9:25:55 PM UTC+11, Adrien Grand wrote:
> > 
> > > Hi,
> > > 
> > > Unfortunately, this is not possible, aggregations cannot return whole  
> > > documents today.
> > > 
> > > On Wed, Mar 19, 2014 at 1:07 AM, Erich Lin [el...@onekingslane.com](mailto:el...@onekingslane.com)  
> > > wrote:
> > > 
> > > > It seems aggregation will return the count of documents for each bucket.
> > > > 
> > > > Can I also retrieve the documents within each bucket that matched that  
> > > > bucket criteria?
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > 
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > Adrien Grand
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a581aa2b-4eae-49db-baeb-07b64ee26ce1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a581aa2b-4eae-49db-baeb-07b64ee26ce1%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [October 2, 2014, 10:29am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/7 "2014-10-02T10:29:16Z")

</div>

It is not really a limitation but rather a design decision: there is no  
limit on the number of documents that can fall into a bucket so we cannot  
have an option to return them all. However we have a top\_hits aggregation  
that can return some of the documents that fell into the bucket:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Thu, Oct 2, 2014 at 11:40 AM, Nicolas F [nicolas.frelat@gmail.com](mailto:nicolas.frelat@gmail.com) wrote:

> Hi,
> 
> Is that limitation still true in versions 1.3.4 or 1.4.0?
> 
> Nicolas F
> 
> Le vendredi 25 avril 2014 12:27:28 UTC+2, Adrien Grand a écrit :
> 
> > A work-around could be to run a terms aggregation on the \_uid field in  
> > order to get the uids back. But beware that this will require loading  
> > field data for the \_uid field, which can be quite expensive.
> > 
> > On Wed, Apr 23, 2014 at 8:37 AM, Pratikshya Kuinkel [prati....@gmail.com](mailto:prati....@gmail.com)  
> > wrote:
> > 
> > > Is there any work around to this problem? How can I know which documents  
> > > belonged to the bucket? Can it at least return id of the document?
> > > 
> > > On Thursday, March 20, 2014 9:25:55 PM UTC+11, Adrien Grand wrote:
> > > 
> > > > Hi,
> > > > 
> > > > Unfortunately, this is not possible, aggregations cannot return whole  
> > > > documents today.
> > > > 
> > > > On Wed, Mar 19, 2014 at 1:07 AM, Erich Lin [el...@onekingslane.com](mailto:el...@onekingslane.com)  
> > > > wrote:
> > > > 
> > > > > It seems aggregation will return the count of documents for each  
> > > > > bucket.
> > > > > 
> > > > > Can I also retrieve the documents within each bucket that matched that  
> > > > > bucket criteria?
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to the Google  
> > > > > Groups "elasticsearch" group.  
> > > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > > 
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40goo  
> > > > > [glegroups.com](http://glegroups.com)  
> > > > > [https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/0e5c1001-e3bb-4345-849e-3b77816411d8%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .  
> > > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > > 
> > > > --  
> > > > Adrien Grand
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/2e469e40-25c2-46b3-9f0e-79b1b6544423%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > > 
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > Adrien Grand
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/a581aa2b-4eae-49db-baeb-07b64ee26ce1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a581aa2b-4eae-49db-baeb-07b64ee26ce1%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/a581aa2b-4eae-49db-baeb-07b64ee26ce1%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/a581aa2b-4eae-49db-baeb-07b64ee26ce1%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7uS2Ctn3h8w5\_qz1ZYf63b5Fsg49EMtCyQGwxUoagpsA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j7uS2Ctn3h8w5_qz1ZYf63b5Fsg49EMtCyQGwxUoagpsA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood\_2](https://avatars.discourse-cdn.com/v4/letter/m/c77e96/32.png) [@Mark\_Harwood\_2](https://discuss.elastic.co/u/Mark_Harwood_2)\
**Post date:** [October 2, 2014, 12:30pm UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/8 "2014-10-02T12:30:23Z")

</div>

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#search-aggregations-metrics-top-hits-aggregation](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-hits-aggregation.html#search-aggregations-metrics-top-hits-aggregation)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/60104d1a-cf68-4b09-babe-4524e5c58d5f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/60104d1a-cf68-4b09-babe-4524e5c58d5f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:58am UTC](https://discuss.elastic.co/t/can-aggregation-return-the-documents-in-each-bucket/16443/9 "2017-07-06T00:58:40Z")

</div>


