import type { Client } from '@elastic/elasticsearch' ; import { asyncForEach } from '@kbn/std' ; export async function deleteAllPipelines ( client , logger ) { const pipelines = await client . ingest . getPipeline ( ) ; const pipeLineIds = Object . keys ( pipelines ) ; await logger . debug ( pipelines ) ; if ( pipeLineIds . length > 0 ) { await asyncForEach ( pipeLineIds , async ( newId ) => { await client . ingest . deletePipeline ( { id : newId } ) ; } ) ; } } export async function putSamplePipeline ( client ) { return await client . ingest . putPipeline ( { id : 'testPipeline' , body : { description : 'describe pipeline' , version : 123 , processors : [ { set : { field : 'foo' , value : 'bar' , } , } , ] , } , } , { meta : true } ) ; }