import { rangeQuery } from '../../../../../observability/server' ; import { ProcessorEvent } from '../../../../common/processor_event' ; import { OBSERVER_VERSION_MAJOR } from '../../../../common/elasticsearch_fieldnames' ; import { Setup } from '../../../lib/helpers/setup_request' ; export async function getLegacyDataStatus ( setup , start , end ) { const { apmEventClient } = setup ; const params = { terminate_after : 1 , apm : { events : [ ProcessorEvent . transaction ] , includeLegacyData : true , } , body : { size : 0 , query : { bool : { filter : [ { range : { [ OBSERVER_VERSION_MAJOR ] : { lt : 7 } } } , ... rangeQuery ( start , end ) , ] , } , } , } , } ; const resp = await apmEventClient . search ( 'get_legacy_data_status' , params ) ; const hasLegacyData = resp . hits . total . value > 0 ; return hasLegacyData ; }