Can anyone convert array query to ejs aggregration query

Below is my query to get data from Elastic search Index can anyone convert it in form of ejs aggregation help would be appreciated.

{
"aggs": {
"parentsku": {
"terms": {
"field": "parentSku",
"order": {
"_term": "asc"
},
"size": 2
},
"aggs": {
"cost": {
"stats": {
"field": "directCost"
}
},
"sales": {
"stats": {
"field": "revenu"
}
},
"quantity": {
"stats": {
"field": "quantity"
}
}
}
}
},
"query": {
"filtered": {
"filter": {
"range": {
"quantity": {
"gte": "500"
}
}
}
}
}
}