Aggregations: Scriptable Metrics Aggregation

A metrics aggregation which runs specified scripts at the init, collect, combine, and reduce phases

Closes #5923
Maybe we could also give examples of simple aggregations (eg. sum or terms) reimplemented with scripted_metric to make it clear how it works?