# How to do pagination to buckets within the composite aggregation result?

**URL:** <https://discuss.elastic.co/t/how-to-do-pagination-to-buckets-within-the-composite-aggregation-result/198517>\
**Category:** Elasticsearch\
**Created:** [September 7, 2019, 4:48pm UTC](https://discuss.elastic.co/t/how-to-do-pagination-to-buckets-within-the-composite-aggregation-result/198517 "2019-09-07T16:48:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![111203](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111203/32/53501_2.png) [@111203](https://discuss.elastic.co/u/111203)\
**Post date:** [September 7, 2019, 4:48pm UTC](https://discuss.elastic.co/t/how-to-do-pagination-to-buckets-within-the-composite-aggregation-result/198517/1 "2019-09-07T16:48:27Z")

</div>

I use the composite aggregation query below on the order data set,

Is there any possible to do pagination to buckets within the composite aggregation result ? If can , but how?

If can't , How to do multiple field aggregation with pagination ?

- mapping  
{  
"order": {  
"mappings": {  
"properties": {  
"purchased\_at": {  
"type": "date"  
},  
"sales\_channel": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"salesman": {  
"properties": {  
"id": {  
"type": "long"  
},  
"name": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
},  
"status": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"total\_amount": {  
"type": "float"  
}  
}  
}  
}  
}
- query

GET /order/\_doc/\_search  
{  
"size": 0,  
"aggs": {  
"my\_buckets": {  
"composite": {  
"sources": [  
{  
"salesman.id": {  
"terms": {  
"field": "salesman.id",  
"order": "desc"  
}  
}  
},  
{  
"status": {  
"terms": {  
"field": "status.keyword",  
"order": "desc"  
}  
}  
},  
{  
"sales\_channel": {  
"terms": {  
"field": "sales\_channel.keyword"  
}  
}  
}  
]  
},  
"aggs": {  
"min\_total\_amount": {  
"min": {  
"field": "total\_amount"  
}  
}  
}  
}  
}  
}

---

<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:** [October 5, 2019, 5:01pm UTC](https://discuss.elastic.co/t/how-to-do-pagination-to-buckets-within-the-composite-aggregation-result/198517/2 "2019-10-05T17:01:52Z")

</div>

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