import { IMetricAggConfig , MetricAggParam } from '../metric_agg_type' ; param { string } paramName returns { function } export const forwardModifyAggConfigOnSearchRequestStart = ( paramName ) => { return ( aggConfig , searchSource ? , request ? ) => { if ( ! aggConfig || ! aggConfig . params ) { return ; } const nestedAggConfig = aggConfig . getParam ( paramName ) ; if ( nestedAggConfig && nestedAggConfig . type && nestedAggConfig . type . params ) { nestedAggConfig . type . params . forEach ( ( param ) => { if ( param . modifyAggConfigOnSearchRequestStart ) { param . modifyAggConfigOnSearchRequestStart ( nestedAggConfig , searchSource , request ) ; } } ) ; } } ; } ;