# How to stream results from a composite aggregation

**URL:** <https://discuss.elastic.co/t/how-to-stream-results-from-a-composite-aggregation/131955>\
**Category:** Elasticsearch\
**Created:** [May 15, 2018, 2:25pm UTC](https://discuss.elastic.co/t/how-to-stream-results-from-a-composite-aggregation/131955 "2018-05-15T14:25:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ld\_pvl](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@ld\_pvl](https://discuss.elastic.co/u/ld_pvl)\
**Post date:** [May 15, 2018, 2:25pm UTC](https://discuss.elastic.co/t/how-to-stream-results-from-a-composite-aggregation/131955/1 "2018-05-15T14:25:04Z")

</div>

Hi Team,

I am doing a [composite aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html) and from the docs:

> This aggregation provides a way to stream all buckets of a specific aggregation similarly to what scroll does for documents.

But I am unsure how I can do the streaming as there are no examples in the docs although the docs state the above.

Should I use the scroll API or should I loop and use the [`after`](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html#_after) parameter and build a new search multiple times?

Cheers,

---

<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:** [June 12, 2018, 2:25pm UTC](https://discuss.elastic.co/t/how-to-stream-results-from-a-composite-aggregation/131955/2 "2018-06-12T14:25:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
