import type { Annotation , Panel } from '../../../../common/types' ; import { buildAnnotationRequest } from './build_request_body' ; import type { VisTypeTimeseriesRequestHandlerContext , VisTypeTimeseriesRequestServices , VisTypeTimeseriesVisDataRequest , } from '../../../types' ; import type { SearchStrategy , SearchCapabilities } from '../../search_strategies' ; export type AnnotationServices = VisTypeTimeseriesRequestServices & { capabilities : SearchCapabilities ; requestContext : VisTypeTimeseriesRequestHandlerContext ; searchStrategy : SearchStrategy ; } ; export async function getAnnotationRequestParams ( req , panel , annotation , { esShardTimeout , esQueryConfig , capabilities , uiSettings , cachedIndexPatternFetcher , } ) { const annotationIndex = await cachedIndexPatternFetcher ( annotation . index_pattern ) ; const request = await buildAnnotationRequest ( { req , panel , annotation , esQueryConfig , annotationIndex , capabilities , uiSettings , } ) ; return { index : annotationIndex . indexPatternString , body : { ... request , runtime_mappings : annotationIndex . indexPattern ?. getComputedFields ( ) . runtimeFields ?? { } , timeout : esShardTimeout > 0 ? `${ esShardTimeout }ms` : undefined , } , } ; }