import { getIndexPatternKey } from '../../../../common/index_patterns_utils' ; import { TSVB_METRIC_TYPES } from '../../../../common/enums' ; import { KBN_FIELD_TYPES } from '../../../../../../data/public' ; import type { Metric , IndexPatternValue } from '../../../../common/types' ; import type { VisFields } from '../../lib/fetch_fields' ; export const checkIfNumericMetric = ( metric , fields , indexPattern ) => { if ( metric ?. type === TSVB_METRIC_TYPES . TOP_HIT ) { const selectedField = fields [ getIndexPatternKey ( indexPattern ) ] ?. find ( ( { name } ) => name === metric ?. field ) ; return selectedField ?. type === KBN_FIELD_TYPES . NUMBER ; } return true ; } ;