import { SharedGlobalConfig , IUiSettingsClient } from '../../../../../core/server' ; import { UI_SETTINGS } from '../../../common/constants' ; export function getShardTimeout ( config ) { const timeout = config . opensearch . shardTimeout . asMilliseconds ( ) ; return timeout ? { timeout : `${ timeout }ms` , } : { } ; } export async function getDefaultSearchParams ( uiSettingsClient ) { const ignoreThrottled = ! ( await uiSettingsClient . get ( UI_SETTINGS . SEARCH_INCLUDE_FROZEN ) ) ; const maxConcurrentShardRequests = await uiSettingsClient . get < number > ( UI_SETTINGS . COURIER_MAX_CONCURRENT_SHARD_REQUESTS ) ; return { maxConcurrentShardRequests : maxConcurrentShardRequests > 0 ? maxConcurrentShardRequests : undefined , ignoreThrottled , ignoreUnavailable : true , trackTotalHits : true , } ; } internal export const getAsyncOptions = ( ) => ( { waitForCompletionTimeout : '100ms' , keepAlive : '1m' , } ) ;