import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/types' ; import { ApmMlJob } from '../../../common/anomaly_detection/apm_ml_job' ; export function apmMlJobsQuery ( jobs ) { if ( ! jobs . length ) { throw new Error ( 'At least one ML job should be given' ) ; } return [ { terms : { job_id : jobs . map ( ( job ) => job . jobId ) , } , } , ] as QueryDslQueryContainer [ ] ; }