Elasticsearch query to aggregate results of buckets

Hi ,
here is my query:
GET /presence_client/client_stats/_search
{
"size" : 0,
"aggs": {
"macs": {
"terms": {
"field": "_parent"
},
"aggs": {
"by_store": {
"terms": {
"field": "store_id"
}
}
}
}
}
}

and the result is

{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 5,
"max_score": 0,
"hits": []
},
"aggregations": {
"macs": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "mac_2",
"doc_count": 3,
"by_store": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 101,
"doc_count": 2
},
{
"key": 100,
"doc_count": 1
}
]
}
},
{
"key": "mac_1",
"doc_count": 2,
"by_store": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": 100,
"doc_count": 2
}
]
}
}
]
}
}
}

From here i want to consume the result of by_store aggregation to count how many macs, had a doc_count in the range

[0- 5]
[5 - 10]
[10 -20] etc ..

Basically i want to do a range operation on the doc_count returned by each bucket of "by_store" aggregation.

Thanks in Advance!
Manaswini