Aggregations: Scriptable Metrics Aggregation

A metrics aggregation which runs specified scripts at the init, collect, combine, and reduce phases

Closes #5923
I'm wondering if we should add it to the context all the time instead of adding it just when parameters are not set? For example, I just tried the following aggregation to reimplement `sum` and it didn't work (always returns 0). I assume it it because I cannot modify the context? Or am I doing something wrong? If I change sum to be a property of an aggregation object instead of being its own variable then it works.

```
GET test/_search
{
  "aggs": {
    "s": {
      "scripted_metric": {
        "params": { "sum": 0 },
        "map_script": "for (n in doc['f'].values) {sum += n};",
        "combine_script": "return sum",
        "reduce_script": "sum = 0; for (a in aggregations) {sum += a}; return sum;"
      }
    }
  }
}
```