Hi
Possibly this can be achieved by Pipeline aggregations in ES. . These are aggregations that work on the result of other aggregations. In your example, you could use a bucket_script pipeline aggregation. For ex: I just considered sum_1 and sum_2
"aggs": {
  "sum_1": {
    "sum": {
      "field": "abc"
    }
  },
  "sum_2": {
    "sum": {
      "field": "def"
    }
  },
  "division": {
    "bucket_script": {
      "buckets_path": {
        "my_var1": "sum_1",
        "my_var2": "sum_2"
      },
      "script": "params.my_var1 / params.my_var2"
    }
  }
}
Also follow along the math count detailed post in kibana discuss :Doing Math over count of events . This might help as well.
thanks
Rashmi