lib/Elastica/QueryBuilder/DSL/Aggregation.php
public function scripted_metric(
        string $name,
        string $initScript = null,
        string $mapScript = null,
        string $combineScript = null,
        string $reduceScript = null
    ): ScriptedMetric {
        return new ScriptedMetric($name, $initScript, $mapScript, $combineScript, $reduceScript);
    }
public function scripted_metric(
        string $name,
        string $initScript = null,
        string $mapScript = null,
        string $combineScript = null,
        string $reduceScript = null
    ): ScriptedMetric {
        return new ScriptedMetric($name, $initScript, $mapScript, $combineScript, $reduceScript);
    }
public function scripted_metric ( string $ name , string $ initScript = null , string $ mapScript = null , string $ combineScript = null , string $ reduceScript = null ) : ScriptedMetric { return new ScriptedMetric ( $ name , $ initScript , $ mapScript , $ combineScript , $ reduceScript ) ; }
scripted metric aggregation.

@see https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-scripted-metric-aggregation.html

@param string      $name
@param string|null $initScript
@param string|null $mapScript
@param string|null $combineScript
@param string|null $reduceScript

@return ScriptedMetric
scripted metric aggregation .