[Discover] Add support for unmapped fields using the fields API#89074
[Discover] Add support for unmapped fields using the fields API#89074majagrubic merged 94 commits intoelastic:masterfrom
Conversation
…ibana into discover-ssource-fields
|
@elasticmachine merge upstream |
| @@ -0,0 +1,450 @@ | |||
| { | |||
There was a problem hiding this comment.
since you're using
test/functional/fixtures/es_archiver/unmapped_fields
for your functionals, you can delete
test/functional/fixtures/es_archiver/data
| */ | ||
| unmappedFieldsConfig?: { | ||
| /** | ||
| * callback funtction to change the value of `showUnmappedFields` flag |
kertal
left a comment
There was a problem hiding this comment.
It's looking pretty good 👍 (so far just minor remarks) , while testing I've found one case that I think needs adaptation or discussion. when adding a pre712 saved search, unmapped fields are displayed in Discover, but not when using the saved search on a Dashboard:
saved-search-pre712.mp4
|
@elasticmachine merge upstream |
|
@kertal I fixed the embeddable so that it works with the new API now |
|
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
Page load bundle
Saved Objects .kibana field count
History
To update your PR or re-run it, just comment with: |
kertal
left a comment
There was a problem hiding this comment.
Code LGTM 👍, embeddable now works. Tested locally using Chrome/Safari, works as expected. One note: using the Angular legacy grid, rendering of records in the table are not updated when there's a refetch when switching the Show unmapped. This is due to the internal Angular caching works. There's no easy workaround here than: switching to EuiDataGrid. There it works, so this should not block this PR.
| ); | ||
| if (useNewFieldsApi) { | ||
| searchSource.removeField('fieldsFromSource'); | ||
| const fields: Record<string, any> = { field: '*' }; |
There was a problem hiding this comment.
Nit: another any that could bite the dust
There was a problem hiding this comment.
Will address this in the next PR
…#89074) (#90184) * [Discover] Add support for unmapped fields using the fields API (#89074) * Add search source to example plugin. * Add uiSetting for fields API. * Update SearchSource to support fields API. * [PoC] reading from the fields API in Discover * Add N fields as a default column * Make fields column non-removeable * Do not add 'fields' to state * Remove fields from app state and read from source when needed * Remove fields column if a new column is added * Add search source to example plugin. * Add uiSetting for fields API. * Update SearchSource to support fields API. * Improve error handling in search examples plugin. * Add unit tests for legacy behavior. * Remove uiSettings feature flag; add fieldsFromSource config. * Rewrite flatten() based on final API design. * Update example app based on final API design. * Update maps app to use legacy fieldsFromSource. * Update Discover to use legacy fieldsFromSource. * Rename source filters to field filters. * Address feedback. * Update generated docs. * Update maps functional test. * Formatting fields column similar to _source * Moving logic for using search API to updating search source * Fix small merge error * Move useSource switch to Discover section of advanced settings * Do not use fields and source at the same time * Remove unmapped fields switch * Add basic support for grouping multifields * Remove output.txt * Fix some merge leftovers * Fix some merge leftovers * Fix merge errors * Fix typescript errors and update nested fields logic * Add a unit test * Fixing field formats * Fix multifield selection logic * Request all fields from source * Fix eslint * Fix default columns when switching between _source and fields * More unit tests * Update API changes * Add unit test for discover field details footer * Remove unused file * Remove fields formatting from index pattern * Remove unnecessary check * Addressing design comments * Fixing fields column display and renaming it to Document * Adding more unit tests * Adding a missing check for useNewFieldsAPI; minor fixes * Fixing typescript error * Remove unnecessary console statement * Add missing prop * Fixing import order * Adding functional test to test fields API * [Functional test] Clean up in after * Fixing context app * Addressing PR comments * Add support for unmapped fields * Add data migration * Add toggle unmapped fields logic * Adding more unit tests * Some cleanup * More unit tests * Fixing failing snapshot * Add tooltip next to unmapped switch * Add functional test for the feature * Fixing a typo in a functional test * Refetch data when unmapped fields value changes * Updating mapping * Support for fields API in search embeddable * Addressing PR comments * Fix failing unit test * Updating the text Co-authored-by: Luke Elmers <luke.elmers@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> * Fixing ES license Co-authored-by: Luke Elmers <luke.elmers@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
Fixes #88192.
This PR adds support for unmapped fields using the new fields API. The logic we discussed to implement this is as follows:
Current flow:

(notice that for same index pattern unmapped fields don't show if it's a new saved search, but they show up when you load a pre-existing one)
How to test this?
Checklist
Delete any items that are not applicable to this PR.
For maintainers