Skip to content
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] Modify columns and sort when switching index pattern #74336

Conversation

kertal
Copy link
Member

@kertal kertal commented Aug 5, 2020

Summary

When switching index pattern in Discover, this PR removes the columns and sort that are not available in the new index pattern. Selected fields that are neither part of the current and next index pattern are not removed (E.g. products of our kibana_sample_data_ecommerce). In the following example, when switching index pattern DistanceKilometers & DistanceMiles are remove because they are not part of the kibana_sample_data_commerce index pattern. And since no other column, that both index patterns share, was selected, _source as default column is displayed.

image

You can opt out in Advanced Settings if you prefer the columns not to be modified
Bildschirmfoto 2020-10-01 um 10 49 19

Fixes #57322
Fixes #45557
Fixes #45988
Fixes #54653

Checklist

@kertal kertal self-assigned this Aug 5, 2020
@kertal kertal added Feature:Discover Discover Application Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Aug 5, 2020
@kertal
Copy link
Member Author

kertal commented Aug 17, 2020

@elasticmachine merge upstream

@kertal kertal marked this pull request as ready for review October 2, 2020 11:07
@kertal kertal requested a review from a team October 2, 2020 11:07
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@kertal
Copy link
Member Author

kertal commented Oct 5, 2020

@elasticmachine merge upstream

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with and without advanced setting and works well, LGTM. Not sure about the unknown fields case but not a blocker

} as IndexPattern;

describe('Discover getSwitchIndexPatternAppState', () => {
test('removing fields that are not part of the next index pattern, keeping unknown fields ', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the reasoning behind this? How would a user run into this case and why would they want to keep the unknown fields?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, imagine you have 2 ecommerce index patterns, and you've selected products, then switching index patterns wouldn't remove them.
Bildschirmfoto 2020-10-05 um 17 56 22

@kertal kertal merged commit 82a6d39 into elastic:master Oct 6, 2020
kertal added a commit to kertal/kibana that referenced this pull request Oct 6, 2020
…tic#74336)

* Modify columns and sort when switching index pattern

* Add unit tests

* Add uiSetting to allow switch to legacy behavior
gmmorris added a commit to gmmorris/kibana that referenced this pull request Oct 6, 2020
* master: (85 commits)
  Refactor attribute service (elastic#78414)
  [APM] Add default message to alerts. (elastic#78930)
  [Discover] Modify columns and sort when switching index pattern (elastic#74336)
  Document ts project references setup (elastic#78586)
  build all ts refs in single kbn:bootstrap (elastic#79438)
  [TSVB] Allow string fields on value count aggregation (elastic#79267)
  [SECURITY SOLUTION] Investigate EQL signal in timeline (elastic#79049)
  [Fleet] Add loading spinner to page headers (elastic#79568)
  [Security Solution][Resolver] Resolver query panel load more (elastic#79160)
  Add type row to monitor detail page. (elastic#79556)
  Remove license refresh from setup (elastic#79518)
  [docker] add reporting fonts (elastic#74806)
  [SECURITY_SOLUTION][ENDPOINT] Add info about trusted apps to the page subtitle + create flyout (elastic#79558)
  Trim Hash value before validating it (elastic#79545)
  Warn users when security is not configured (elastic#78545)
  update copy styling (elastic#79313)
  Update dependency @elastic/charts to v23.1.1 (elastic#78459)
  Introduce geo-threshold alerts (elastic#76285)
  elastic#76920 Show base breadcrumb when there is an error booting the app (elastic#79571)
  remove react-intl from kibana and keep it inside only i18n package (elastic#78956)
  ...
kertal added a commit that referenced this pull request Oct 6, 2020
…) (#79616)

* Modify columns and sort when switching index pattern

* Add unit tests

* Add uiSetting to allow switch to legacy behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.10.0 v8.0.0
Projects
None yet
5 participants