Aggregations: Scriptable Metrics Aggregation

A metrics aggregation which runs specified scripts at the init, collect, combine, and reduce phases

Closes #5923
From looking at the ScriptService it seems that only objects and arrays provided in the params will be updated as the params map is copied when the script is compiled. so your example won't work but the following would:

```
GET test/_search
{
  "aggs": {
    "s": {
      "scripted_metric": {
        "params": { "result" : { "sum": 0 } },
        "map_script": "for (n in doc['f'].values) {result.sum += n};",
        "combine_script": "return result.sum",
        "reduce_script": "sum = 0; for (a in aggregations) {sum += a}; return sum;"
      }
    }
  }
}
```