import { MeiliSearch , IndexResponse , SearchResponse , Hits , Hit , SearchParams , } from '../../../../' ; const config = { host : 'http://127.0.0.1:7700' , apiKey : 'masterKey' } ; interface Movie { id : number ; title : string ; genre ? : string ; } const client = new MeiliSearch ( config ) ; const indexUid = "movies" ; ( async ( ) => { await client . deleteIndex ( indexUid ) ; const { uid } = await client . createIndex ( indexUid ) ; await client . waitForTask ( uid ) ; const index = client . index ( indexUid ) ; const indexes = await client . getIndexes ( ) ; indexes . map ( ( index ) => { console . log ( index . uid ) ; } ) ; const searchParams = { limit : 5 , attributesToRetrieve : [ 'title' , 'genre' ] , attributesToHighlight : [ 'title' ] } ; indexes . map ( ( index ) => index . uid ) ; const res = await index . search ( 'avenger' , searchParams ) ; const { hits } = res ; hits . map ( ( hit ) => { console . log ( hit ?. genre ) ; console . log ( hit . title ) ; console . log ( hit ?. _formatted ?. title ) ; } ) ; await index . delete ( ) ; } ) ( ) ;