-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[One Discover] Fix document comparison mode and the field statistics …
…tab when using Smart Fields (#184172) ## Summary This addresses the bugs listed in #181674 (#181621 and #178970). Smart Fields are compound fields, as such there is no "real" backing field for them. In these scenarios where we can't use them directly we fall back to the `fallbackFields` configured for them. [@amyjtechwriter please could you check the copy](#181621 (comment)). I think `derived from...` would have sounded better, but it felt at odds with the scenario where you might specifically pick a field that is also a fallback field for a smart field. ## Reviewer notes - There were quite a lot of cross cutting concerns here between the `unified-field-list`, `unified-data-table`, core Discover code, `discover-utils`, and the `data_vizualizer` plugin for the field statistics table. Where I'd have liked to potentially put more things in the discover-utils it wasn't possible due to circular project references. - I've not added any functional tests for now as we'd be adding them to the Observability Logs Explorer which is going to be deprecated in due course. This ties in with part three of #181674. - A `renderFieldName` prop has been added to the field statistics table, this seemed to be the least intrusive way forward rather than a new / comprehensive cell rendering change (similar to the external cell renderers). - I've used the original [`fallbackFields`](https://github.com/elastic/kibana/blob/main/src/plugins/discover/common/data_types/logs/constants.ts#L35) configurations but the [virtual column components actually render a bit extra](https://github.com/elastic/kibana/blob/main/packages/kbn-discover-utils/src/utils/get_message_field_with_fallbacks.ts#L13). Am I missing anything with regards to potentially extending the `fallbackFields` definitions? ## Screenshots <img width="1253" alt="Screenshot 2024-05-23 at 20 25 57" src="https://github.com/elastic/kibana/assets/471693/c2982f45-c8fa-4caa-935d-7007745ae2ce"> <img width="1477" alt="Screenshot 2024-05-23 at 20 26 21" src="https://github.com/elastic/kibana/assets/471693/3145fbd1-071e-42fd-a94d-beb15c29c739"> --------- Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
- Loading branch information
1 parent
76837c0
commit 105ba94
Showing
25 changed files
with
492 additions
and
36 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
packages/kbn-discover-utils/src/__mocks__/additional_field_groups.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { DataViewField } from '@kbn/data-views-plugin/common'; | ||
|
||
const smartFields = [ | ||
new DataViewField({ | ||
name: 'content', | ||
type: 'smart_field', | ||
searchable: false, | ||
aggregatable: false, | ||
}), | ||
]; | ||
const fallbackFields = { | ||
content: ['message'], | ||
}; | ||
|
||
export const additionalFieldGroups = { | ||
smartFields, | ||
fallbackFields, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ | |
|
||
export * from './data_view'; | ||
export * from './es_hits'; | ||
export * from './additional_field_groups'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
.../components/compare_documents/hooks/__snapshots__/use_comparison_cell_value.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,5 +36,6 @@ | |
"@kbn/field-utils", | ||
"@kbn/react-field", | ||
"@kbn/shared-ux-utility", | ||
"@kbn/unified-field-list", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.