Honor maxConcurrentShardRequests setting. (#30049)
This commit is contained in:
parent
2850fd6735
commit
4a4ed6bb55
|
@ -25,6 +25,10 @@ import {
|
|||
HapiGraphQLPluginOptions,
|
||||
} from './apollo_server_hapi';
|
||||
|
||||
interface CallWithRequestParams extends GenericParams {
|
||||
max_concurrent_shard_requests?: number;
|
||||
}
|
||||
|
||||
export class InfraKibanaBackendFrameworkAdapter implements InfraBackendFrameworkAdapter {
|
||||
public version: string;
|
||||
|
||||
|
@ -85,13 +89,22 @@ export class InfraKibanaBackendFrameworkAdapter implements InfraBackendFramework
|
|||
public async callWithRequest(
|
||||
req: InfraFrameworkRequest<Legacy.Request>,
|
||||
endpoint: string,
|
||||
params: GenericParams,
|
||||
params: CallWithRequestParams,
|
||||
...rest: any[]
|
||||
) {
|
||||
const internalRequest = req[internalInfraFrameworkRequest];
|
||||
const { elasticsearch } = internalRequest.server.plugins;
|
||||
const { callWithRequest } = elasticsearch.getCluster('data');
|
||||
const includeFrozen = await internalRequest.getUiSettingsService().get('search:includeFrozen');
|
||||
if (endpoint === 'msearch') {
|
||||
const maxConcurrentShardRequests = await internalRequest
|
||||
.getUiSettingsService()
|
||||
.get('courier:maxConcurrentShardRequests');
|
||||
if (maxConcurrentShardRequests > 0) {
|
||||
params = { ...params, max_concurrent_shard_requests: maxConcurrentShardRequests };
|
||||
}
|
||||
}
|
||||
|
||||
const fields = await callWithRequest(
|
||||
internalRequest,
|
||||
endpoint,
|
||||
|
|
Loading…
Reference in a new issue