-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Discover] Show correct data for top level object columns #91954
[Discover] Show correct data for top level object columns #91954
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
src/plugins/discover/public/application/components/discover_grid/get_render_cell_value.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Breaks properties of
enabled: false
object fields (shown as empty) - Breaks properties of
enabled: false
object fields,enabled: false
object root fields and nested fields for data grid (all shown as empty - these work fine in the legacy table)
const highlightPairs: Array<[string, string]> = []; | ||
const sourcePairs: Array<[string, string]> = []; | ||
Object.entries(innerColumns).forEach(([key, values]) => { | ||
const subField = indexPattern.getFieldByName(key)!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This subField
can be undefined if the object is enabled: false
, crashing discover.
@flash1293 fixed and added unit tests. Here are the two scenarios when dealing with unmapped fields: |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const subField = indexPattern.getFieldByName(key); | ||
const formatter = subField | ||
? indexPattern.getFormatterForField(subField) | ||
: { convert: (v: string, ...rest: unknown[]) => v.toString() }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if I can't think of a situation where null
comes around, String(v)
would be prepared for this impossible event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work dear @wylieconlon , thanks a lot for fixing highlighting for the data grid as a side effect. Tested locally in Chrome, Firefox, Safari, MacOs ... works as expected
Thanks @kertal updated from your suggestion. @flash1293 I opened an issue for that: #92223 |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
) * [Discover] Show correct data for top level object columns * Fix bug with missing fields * Fix bug in data grid * Fix remaining bug in datagrid * Change use of API to work with any type Co-authored-by: Kibana Machine <[email protected]>
…92268) * [Discover] Show correct data for top level object columns * Fix bug with missing fields * Fix bug in data grid * Fix remaining bug in datagrid * Change use of API to work with any type Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
…92269) * [Discover] Show correct data for top level object columns * Fix bug with missing fields * Fix bug in data grid * Fix remaining bug in datagrid * Change use of API to work with any type Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
This can be tested with the
kibana_sample_data_ecommerce
data set. I recommend adding a KQL search forproducts.product_name: Boots
to test the highlighting feature.The easiest way to test is to modify the URL by looking for
columns:!()
orcolumns:!(_source)
and replace this withcolumns:!(products)
. Then save the search. This is because on master, it's not possible to select theproducts
column from the list of fields: this is working as expected, but users may have previously saved searches on top level objects.Before this, we are trying to basically improve on the behavior from 7.11:
Here are the scenarios that I have tested:
cc @mattkime because I've implemented some logic custom to Discover that is maybe better suited to the index pattern API
Closes #91953
Checklist