global
aggregation
Break out of the aggregation context
GET /orders/_search
{
"query": {
"range": {
"total_amount": {
"gte": 100
}
}
},
"size": 0,
"aggs": {
"all_orders": {
"global": { },
"aggs": {
"stats_amount": {
"stats": {
"field": "total_amount"
}
}
}
}
}
}
Adding aggregation without global context
GET /orders/_search
{
"query": {
"range": {
"total_amount": {
"gte": 100
}
}
},
"size": 0,
"aggs": {
"all_orders": {
"global": { },
"aggs": {
"stats_amount": {
"stats": {
"field": "total_amount"
}
}
}
},
"stats_expensive": {
"stats": {
"field": "total_amount"
}
}
}
}