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

Closes https://github.com/elastic/kibana/issues/164905

This PR replaces individual shard failure and timeout warnings with a
single "incomplete data" warning. This work is required for
https://github.com/elastic/kibana/issues/163381

<img width="500" alt="Screen Shot 2023-09-06 at 9 35 52 AM"
src="77e62792-c1f1-4780-b4f2-3aca24e4691b">

<img width="500" alt="Screen Shot 2023-09-06 at 9 36 00 AM"
src="56f37db1-2b4a-484b-9244-66b352d82dc1">

<img width="500" alt="Screen Shot 2023-09-06 at 9 36 07 AM"
src="4a777963-6e88-4736-9d63-99a2843ebdbb">

### Test instructions
* Install flights and web logs sample data
* Create data view kibana_sample_data*. **Set time field to timestamp**
* open discover and select kibana_sample_data* data view
* Add filter with custom DSL
    ```
    {
      "error_query": {
        "indices": [
          {
            "error_type": "exception",
            "message": "local shard failure message 123",
            "name": "kibana_sample_data_logs",
            "shard_ids": [
              0
            ]
          }
        ]
      }
    }
    ```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2023-09-14 08:55:53 -06:00 committed by GitHub
parent 5bd152369b
commit f3b280f6ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
82 changed files with 1234 additions and 1898 deletions

View file

@ -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([]);
@ -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" />{' '}