Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor search source warnings to return a single warning for 'is_partial' results #165512

Merged
merged 49 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
d4164ab
extract incomplete warning and handle in toasts
nreese Sep 1, 2023
d93aedb
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 1, 2023
2046549
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Sep 1, 2023
7d15531
tslint
nreese Sep 1, 2023
74f7c88
another test case
nreese Sep 1, 2023
e87efd7
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 1, 2023
3d3c439
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 1, 2023
be16158
fix discover
nreese Sep 1, 2023
1385564
remove console.log
nreese Sep 1, 2023
47ca3f9
tslint
nreese Sep 5, 2023
353c528
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 5, 2023
1619d17
tslint packages/kbn-search-response-warnings
nreese Sep 5, 2023
d3e1b37
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 5, 2023
f9ca751
update lens for incomplete warning
nreese Sep 5, 2023
60452d8
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 5, 2023
eb50b70
tslint visualizations plugin
nreese Sep 5, 2023
e75281d
Merge branch 'main' into incomplete_warning
kibanamachine Sep 5, 2023
45868ce
i18n fixes
nreese Sep 5, 2023
ee013d6
round 1 of tslint discover
nreese Sep 5, 2023
243464b
tslint discover
nreese Sep 5, 2023
c3ce686
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 5, 2023
95dae5e
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Sep 5, 2023
a69611b
tslint
nreese Sep 6, 2023
201681f
fix jest tests
nreese Sep 6, 2023
10765c4
display shard failures
nreese Sep 6, 2023
4542867
remove replaced components
nreese Sep 6, 2023
ef0e760
clean up types
nreese Sep 6, 2023
89b8ba6
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 6, 2023
ef1f022
merge with main + i18n fixes
nreese Sep 6, 2023
1baa4f4
fix functional test
nreese Sep 6, 2023
278aab6
remove only
nreese Sep 6, 2023
6bf085e
fix jest test
nreese Sep 6, 2023
2eec12e
Merge branch 'main' into incomplete_warning
kibanamachine Sep 7, 2023
5cf79b0
Update src/plugins/data/public/incomplete_results_modal/incomplete_re…
nreese Sep 7, 2023
413157a
remove translations added in merge conflict resolution
nreese Sep 7, 2023
8f9c6e6
wrap hasUnsupportedDownsampledAggregationFailure tests in describe block
nreese Sep 7, 2023
21c17d9
show time out warning in IncompleteResultsModal
nreese Sep 7, 2023
bb4c71d
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 7, 2023
b724b92
add jest test for IncompleteResultsModal component
nreese Sep 7, 2023
0a4e19d
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 7, 2023
9cd9aac
Merge branch 'main' into incomplete_warning
kibanamachine Sep 11, 2023
cec504f
Merge branch 'main' into incomplete_warning
kibanamachine Sep 12, 2023
6939dd5
fix search source example functional tests
nreese Sep 12, 2023
eb54f57
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Sep 12, 2023
8f4f8cf
change callout close button color to warning to match callout
nreese Sep 13, 2023
7f5bb92
rename 'Show details' to 'View details'
nreese Sep 13, 2023
85c16f0
Merge branch 'main' into incomplete_warning
dej611 Sep 14, 2023
2df8a8a
remove IE11 CSS rule
nreese Sep 14, 2023
8888e3f
update text to 'View details'
nreese Sep 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions examples/search_examples/public/search/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,17 +311,15 @@ export const SearchExamplesApp = ({
const result = await lastValueFrom(
searchSource.fetch$({
abortSignal: abortController.signal,
disableShardFailureWarning: !showWarningToastNotifications,
disableWarningToasts: !showWarningToastNotifications,
inspector,
})
);
setRawResponse(result.rawResponse);

/* Here is an example of using showWarnings on the search service, using an optional callback to
* intercept the warnings before notification warnings are shown.
*
* Suppressing the shard failure warning notification from appearing by default requires setting
* { disableShardFailureWarning: true } in the SearchSourceSearchOptions passed to $fetch
/*
* Set disableWarningToasts to true to disable warning toasts and customize warning display.
* Then use showWarnings to customize warning notification.
*/
if (showWarningToastNotifications) {
setWarningContents([]);
Expand Down Expand Up @@ -498,7 +496,7 @@ export const SearchExamplesApp = ({
{' '}
<FormattedMessage
id="searchExamples.warningsObject"
defaultMessage="Timeout and shard failure warnings for high-level search may be handled in a callback to the showWarnings method on the search service."
defaultMessage="Search warnings may optionally be handed with search service showWarnings method."
/>{' '}
</EuiText>{' '}
<EuiProgress value={loaded} max={total} size="xs" data-test-subj="progressBar" />{' '}
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-es-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export type {
AggregationResultOfMap,
ESFilter,
MaybeReadonlyArray,
ClusterDetails,
} from './src';
9 changes: 8 additions & 1 deletion packages/kbn-es-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
AggregateOf as AggregationResultOf,
AggregateOfMap as AggregationResultOfMap,
SearchHit,
ClusterDetails,
} from './search';

export type ESFilter = estypes.QueryDslQueryContainer;
Expand All @@ -34,4 +35,10 @@ export type ESSearchResponse<
TOptions extends { restTotalHitsAsInt: boolean } = { restTotalHitsAsInt: false }
> = InferSearchResponseOf<TDocument, TSearchRequest, TOptions>;

export type { InferSearchResponseOf, AggregationResultOf, AggregationResultOfMap, SearchHit };
export type {
InferSearchResponseOf,
AggregationResultOf,
AggregationResultOfMap,
SearchHit,
ClusterDetails,
};
9 changes: 9 additions & 0 deletions packages/kbn-es-types/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,3 +644,12 @@ export type InferSearchResponseOf<
>;
};
};

export interface ClusterDetails {
status: 'running' | 'successful' | 'partial' | 'skipped' | 'failed';
indices: string;
took?: number;
timed_out: boolean;
_shards?: estypes.ShardStatistics;
failures?: estypes.ShardFailure[];
}
6 changes: 2 additions & 4 deletions packages/kbn-search-response-warnings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ export {
type SearchResponseWarningsProps,
} from './src/components/search_response_warnings';

export {
getSearchResponseInterceptedWarnings,
removeInterceptedWarningDuplicates,
} from './src/utils/get_search_response_intercepted_warnings';
export { getSearchResponseInterceptedWarnings } from './src/utils/get_search_response_intercepted_warnings';
export { hasUnsupportedDownsampledAggregationFailure } from './src/utils/has_unsupported_downsampled_aggregation_failure';
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,33 @@

import type { SearchResponseWarning } from '@kbn/data-plugin/public';

export const searchResponseTimeoutWarningMock: SearchResponseWarning = {
type: 'timed_out',
message: 'Data might be incomplete because your request timed out',
reason: undefined,
};

export const searchResponseShardFailureWarningMock: SearchResponseWarning = {
type: 'shard_failure',
message: '3 of 4 shards failed',
text: 'The data might be incomplete or wrong.',
reason: {
type: 'illegal_argument_exception',
reason: 'Field [__anonymous_] of type [boolean] does not support custom formats',
},
};

export const searchResponseWarningsMock: SearchResponseWarning[] = [
searchResponseTimeoutWarningMock,
searchResponseShardFailureWarningMock,
{
type: 'shard_failure',
message: '3 of 4 shards failed',
text: 'The data might be incomplete or wrong.',
reason: {
type: 'query_shard_exception',
reason:
'failed to create query: [.ds-kibana_sample_data_logs-2023.07.11-000001][0] Testing shard failures!',
},
},
{
type: 'shard_failure',
message: '1 of 4 shards failed',
text: 'The data might be incomplete or wrong.',
reason: {
type: 'query_shard_exception',
reason:
'failed to create query: [.ds-kibana_sample_data_logs-2023.07.11-000001][0] Testing shard failures!',
export const searchResponseIncompleteWarningLocalCluster: SearchResponseWarning = {
type: 'incomplete',
message: 'The data might be incomplete or wrong.',
clusters: {
'(local)': {
status: 'partial',
indices: '',
took: 25,
timed_out: false,
_shards: {
total: 4,
successful: 3,
skipped: 0,
failed: 1,
},
failures: [
{
shard: 0,
index: 'sample-01-rollup',
node: 'VFTFJxpHSdaoiGxJFLSExQ',
reason: {
type: 'illegal_argument_exception',
reason:
'Field [kubernetes.container.memory.available.bytes] of type [aggregate_metric_double] is not supported for aggregation [percentiles]',
},
},
],
},
},
];
};