import { i18n } from '@osd/i18n' ; import { MetricAggType } from './metric_agg_type' ; import { METRIC_TYPES } from './metric_agg_types' ; import { OSD_FIELD_TYPES } from '../../../../common' ; import { BaseAggParams } from '../types' ; const minTitle = i18n . translate ( 'data.search.aggs.metrics.minTitle' , { defaultMessage : 'Min' , } ) ; export interface AggParamsMin extends BaseAggParams { field : string ; } export const getMinMetricAgg = ( ) => { return new MetricAggType ( { name : METRIC_TYPES . MIN , title : minTitle , makeLabel ( aggConfig ) { return i18n . translate ( 'data.search.aggs.metrics.minLabel' , { defaultMessage : 'Min {field}' , values : { field : aggConfig . getFieldDisplayName ( ) } , } ) ; } , params : [ { name : 'field' , type : 'field' , filterFieldTypes : [ OSD_FIELD_TYPES . NUMBER , OSD_FIELD_TYPES . DATE ] , } , ] , } ) ; } ;