Subtraction two fields aggregate count in elasticsearch script

I am getting below output after apply aggregate but i have perform subtraction on "key": "in-completed","doc_count": 4 and "key": "completed", "doc_count": 2
expected
output - [in-completed][doc_count] - [completed][doc_count]

Please tell me if its possible in elastic search script because subtraction count need display in kibana dashboard

output-
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 6,
"max_score": 0,
"hits":
},
"aggregations": {
"sessionLengthData": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "in-completed",
"doc_count": 4,
"p-status": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets":
}
},
{
"key": "completed",
"doc_count": 2,
"p-status": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets":
}
}
]
}
}
}

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