Aggregations: Fixes scripted metrics aggregation when used as a sub aggregation


The scripted metric aggregation is now a PER_BUCKET aggregation so that parent buckets are evaluated independently. Also the params and reduceParams are copied for each instance of the aggregator (each parent bucket) so modifications to the values are kept only within the scope of its parent bucket

Closes #8036
Is it just to make sure that some shards are getting several buckets? If yes, I'm not sure we need it since every document generates its own bucket and we have 10 documents at least?