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 maxTitle = i18n . translate ( 'data.search.aggs.metrics.maxTitle' , { defaultMessage : 'Max' , } ) ; export interface AggParamsMax extends BaseAggParams { field : string ; } export const getMaxMetricAgg = ( ) => { return new MetricAggType ( { name : METRIC_TYPES . MAX , title : maxTitle , makeLabel ( aggConfig ) { return i18n . translate ( 'data.search.aggs.metrics.maxLabel' , { defaultMessage : 'Max {field}' , values : { field : aggConfig . getFieldDisplayName ( ) } , } ) ; } , params : [ { name : 'field' , type : 'field' , filterFieldTypes : [ OSD_FIELD_TYPES . NUMBER , OSD_FIELD_TYPES . DATE ] , } , ] , } ) ; } ;