## Summary
Simply changing the type on `ISearchOptions` to work with DataViewLazy.
Nothing that uses `ISearchOption` uses the field list so these are type
only changes
Part of https://github.com/elastic/kibana/pull/183694
## Summary
Revives this https://github.com/elastic/kibana/pull/181969
To do so, I had to create a new package `search-types` and move the
types I need there.
The Discovery team can take it from here.
Note: It also does a cleanup on the types I move, some of them were
declared twice.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Closes https://github.com/elastic/kibana/issues/171570
PR make the following changes
1. Consolidates data EsError logic and Lens EsError logic. This resulted
in being able to remove large parts of lens error_helper.tsx file.
2. Consolidates lens WorkspacePanel error logic. Before PR configuration
errors and data loading errors each rendered their own version of
EuiEmptyPrompt with slightly different behavior. Now, both render
WorkspaceErrors component and have the same behavior
3. Updated lens ExpressionWrapper to return original error to embeddable
output.
### Test - EsError in embeddable
1. install sample web logs
2. create new dashboard
3. Click "Create visualization"
4. Drag "timestamp" field into workspace.
5. Click "Save and return"
6. Add filter
```
{
"error_query": {
"indices": [
{
"error_type": "exception",
"message": "local shard failure message 123",
"name": "kibana_sample_data_logs"
}
]
}
}
```
7. Verify EsError and "View details" action are displayed
<img width="500" alt="Screenshot 2023-12-08 at 1 34 20 PM"
src="1c65b7f3-ece7-4000-a5b2-11127cc38f01">
### Test - multiple configuration errors in lens editor
1. install sample web logs
2. create new lens visualization
3. Drag "timestamp" field into workspace.
4. Add filter
```
{
"error_query": {
"indices": [
{
"error_type": "exception",
"message": "local shard failure message 123",
"name": "kibana_sample_data_logs"
}
]
}
}
```
5. Verify EsError and "View details" action are displayed
<img width="500" alt="Screenshot 2023-12-08 at 1 09 22 PM"
src="22023512-d344-4f99-abbd-8427d764f821">
### Test - EsError in embeddable
1. install sample web logs
2. create new dashboard
3. Click "Create visualization"
4. Drag "timestamp" field into workspace.
5. Change "Vertical axis" to "Cumulative sum". Select "Field" select and
hit delete key
6. Clone layer one or more times
7. Verify pagination is displayed, allowing users to click through all
configuration errors
<img width="500" alt="Screenshot 2023-12-08 at 12 59 18 PM"
src="6302658a-8cf7-4a1a-a117-ae810c0af539">
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
Part of https://github.com/elastic/kibana/issues/171570
PR breaks EsError out of data plugin and into @kbn/search-errors
package. This will allow for future efforts to move [lens error
handing](https://github.com/elastic/kibana/blob/main/x-pack/plugins/lens/public/editor_frame_service/error_helper.tsx)
into this package and more closely align error handling across kibana.
An unplanned part of this PR was moving `BfetchRequestError` into its
own package `@kbn/bfetch`. This is required because `@kbn/search-errors`
package can not import code from a plugin. `BfetchRequestError` could
not be part of `@kbn/search-errors` because that created a circular
dependency graph.
Another unexpected problem found while working on this PR is that the
package had to be included in `ui-shared-deps`. The reason for this is
that `renderSearchError` uses `instanceof EsError` check to determine if
an error is an EsError. This check failed when the package was not
included in `ui-shared-deps` because each plugin got its own copy of
`kbn/search-error` plugin. This meant that `data` plugin had its own
copy of `EsError` class when the error is generated, then `discover`
plugin had its own copy of `EsError` class when the instanceof check
occurs. `instanceof` check unexpectedly returned false in this case.
Moving plugin to `ui-shared-deps` results in a single instance of the
plugin. Thanks @mistic for the help with moving package into
`ui-shared-deps`
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: Davis McPhee <davismcphee@hotmail.com>