mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
allows to disable automatic handling of shard warnings on expressions (#139824)
This commit is contained in:
parent
235679aeaa
commit
64050167af
7 changed files with 19 additions and 3 deletions
|
@ -53,6 +53,7 @@ describe('esaggs expression function - public', () => {
|
|||
query: undefined,
|
||||
searchSessionId: 'abc123',
|
||||
searchSourceService: searchSourceCommonMock,
|
||||
disableShardWarnings: false,
|
||||
timeFields: ['@timestamp', 'utc_time'],
|
||||
timeRange: undefined,
|
||||
};
|
||||
|
@ -138,6 +139,7 @@ describe('esaggs expression function - public', () => {
|
|||
description: 'This request queries Elasticsearch to fetch the data for the visualization.',
|
||||
adapter: undefined,
|
||||
},
|
||||
disableShardFailureWarning: false,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ export interface RequestHandlerParams {
|
|||
searchSourceService: ISearchStartSearchSource;
|
||||
timeFields?: string[];
|
||||
timeRange?: TimeRange;
|
||||
disableShardWarnings?: boolean;
|
||||
getNow?: () => Date;
|
||||
executionContext?: KibanaExecutionContext;
|
||||
}
|
||||
|
@ -45,6 +46,7 @@ export const handleRequest = ({
|
|||
searchSourceService,
|
||||
timeFields,
|
||||
timeRange,
|
||||
disableShardWarnings,
|
||||
getNow,
|
||||
executionContext,
|
||||
}: RequestHandlerParams) => {
|
||||
|
@ -111,6 +113,7 @@ export const handleRequest = ({
|
|||
requestSearchSource
|
||||
.fetch$({
|
||||
abortSignal,
|
||||
disableShardFailureWarning: disableShardWarnings,
|
||||
sessionId: searchSessionId,
|
||||
inspector: {
|
||||
adapter: inspectorAdapters.requests,
|
||||
|
|
|
@ -15,6 +15,7 @@ export type ExecutionContextSearch = {
|
|||
filters?: Filter[];
|
||||
query?: Query | Query[];
|
||||
timeRange?: TimeRange;
|
||||
disableShardWarnings?: boolean;
|
||||
};
|
||||
|
||||
export type ExpressionValueSearchContext = ExpressionValueBoxed<
|
||||
|
|
|
@ -56,7 +56,7 @@ describe('esaggs expression function - public', () => {
|
|||
jest.clearAllMocks();
|
||||
mockHandlers = {
|
||||
abortSignal: jest.fn() as unknown as jest.Mocked<AbortSignal>,
|
||||
getSearchContext: jest.fn(),
|
||||
getSearchContext: jest.fn().mockReturnValue({}),
|
||||
getSearchSessionId: jest.fn().mockReturnValue('abc123'),
|
||||
getExecutionContext: jest.fn(),
|
||||
inspectorAdapters: jest.fn(),
|
||||
|
@ -123,6 +123,7 @@ describe('esaggs expression function - public', () => {
|
|||
searchSessionId: 'abc123',
|
||||
searchSourceService: startDependencies.searchSource,
|
||||
timeFields: args.timeFields,
|
||||
disableShardWarnings: false,
|
||||
timeRange: undefined,
|
||||
getNow: undefined,
|
||||
});
|
||||
|
|
|
@ -36,7 +36,11 @@ export function getFunctionDefinition({
|
|||
}) {
|
||||
return (): EsaggsExpressionFunctionDefinition => ({
|
||||
...getEsaggsMeta(),
|
||||
fn(input, args, { inspectorAdapters, abortSignal, getSearchSessionId, getExecutionContext }) {
|
||||
fn(
|
||||
input,
|
||||
args,
|
||||
{ inspectorAdapters, abortSignal, getSearchSessionId, getExecutionContext, getSearchContext }
|
||||
) {
|
||||
return defer(async () => {
|
||||
const { aggs, indexPatterns, searchSource, getNow } = await getStartDependencies();
|
||||
|
||||
|
@ -52,6 +56,8 @@ export function getFunctionDefinition({
|
|||
return { aggConfigs, indexPattern, searchSource, getNow, handleEsaggsRequest };
|
||||
}).pipe(
|
||||
switchMap(({ aggConfigs, indexPattern, searchSource, getNow, handleEsaggsRequest }) => {
|
||||
const { disableShardWarnings } = getSearchContext();
|
||||
|
||||
return handleEsaggsRequest({
|
||||
abortSignal,
|
||||
aggs: aggConfigs,
|
||||
|
@ -63,6 +69,7 @@ export function getFunctionDefinition({
|
|||
searchSourceService: searchSource,
|
||||
timeFields: args.timeFields,
|
||||
timeRange: get(input, 'timeRange', undefined),
|
||||
disableShardWarnings: (disableShardWarnings || false) as boolean,
|
||||
getNow,
|
||||
executionContext: getExecutionContext(),
|
||||
});
|
||||
|
|
|
@ -58,7 +58,7 @@ describe('esaggs expression function - server', () => {
|
|||
mockHandlers = {
|
||||
abortSignal: jest.fn() as unknown as jest.Mocked<AbortSignal>,
|
||||
getKibanaRequest: jest.fn().mockReturnValue({ id: 'hi' } as KibanaRequest),
|
||||
getSearchContext: jest.fn(),
|
||||
getSearchContext: jest.fn().mockReturnValue({}),
|
||||
getSearchSessionId: jest.fn().mockReturnValue('abc123'),
|
||||
getExecutionContext: jest.fn(),
|
||||
inspectorAdapters: jest.fn(),
|
||||
|
@ -130,6 +130,7 @@ describe('esaggs expression function - server', () => {
|
|||
query: undefined,
|
||||
searchSessionId: 'abc123',
|
||||
searchSourceService: startDependencies.searchSource,
|
||||
disableShardWarnings: false,
|
||||
timeFields: args.timeFields,
|
||||
timeRange: undefined,
|
||||
});
|
||||
|
|
|
@ -72,6 +72,7 @@ export function getFunctionDefinition({
|
|||
query: get(input, 'query', undefined) as any,
|
||||
searchSessionId: getSearchSessionId(),
|
||||
searchSourceService: searchSource,
|
||||
disableShardWarnings: false,
|
||||
timeFields: args.timeFields,
|
||||
timeRange: get(input, 'timeRange', undefined),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue