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"
}
}
}
}
}
}