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] Fix sorting by _score behavior #92132

Merged

Conversation

kertal
Copy link
Member

@kertal kertal commented Feb 22, 2021

Summary

The integration of EuiDataGrid made it necessary to allow the user to un-sort Discover's document table. (#85561) Default sorting of index patterns without time field sorted internally still by _score, but when the user added the _score column, there was no indication that's it's sorted. This PR solves it by automatically adding sorting by _score when the user selects the column, if she/he didn't sort it before by a different field. This also works when adding _score using an index pattern with timefield and it's in an unsorted state. Also this PR increased test coverage

Testing

  • Create an index pattern without timefield in Discover and make use of it
  • Add _score column
  • If no other fields was selected before to sort by, you it should work like this:
sort_by_score.mp4

Checklist

@kertal kertal added the Feature:Discover Discover Application label Feb 22, 2021
@kertal kertal self-assigned this Feb 22, 2021
@kertal
Copy link
Member Author

kertal commented Feb 22, 2021

@elasticmachine merge upstream

@kertal
Copy link
Member Author

kertal commented Feb 22, 2021

@elasticmachine merge upstream

@kertal kertal added Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.12.0 v8.0.0 v7.13.0 release_note:skip Skip the PR/issue when compiling release notes labels Feb 22, 2021
@kertal kertal marked this pull request as ready for review February 22, 2021 16:40
@kertal kertal requested a review from a team February 22, 2021 16:40
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

I tested this and compared against 7.11- it seems like this was already the default behavior before?

Anyway LGTM, but probably needs a second reviewer

@kertal
Copy link
Member Author

kertal commented Feb 22, 2021

I tested this and compared against 7.11- it seems like this was already the default behavior before?

Anyway LGTM, but probably needs a second reviewer

it was, but due to changes after 7.11 it wasn't anymore, so I might rewrite the title 'Improve' which is misleading

@kertal kertal changed the title [Discover] Improve sorting by _score [Discover] Fix sorting by _score behavior Feb 23, 2021
@kertal
Copy link
Member Author

kertal commented Feb 24, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 400.2KB 400.8KB +673.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @kertal

Copy link
Contributor

@majagrubic majagrubic left a comment

Choose a reason for hiding this comment

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

Tested it and works correctly (also not clear to me when was it removed in the first place).

@kertal kertal merged commit fdc637d into elastic:master Feb 24, 2021
kertal added a commit to kertal/kibana that referenced this pull request Feb 24, 2021
kertal added a commit to kertal/kibana that referenced this pull request Feb 24, 2021
gmmorris added a commit to gmmorris/kibana that referenced this pull request Feb 25, 2021
…bana into task-manager/docs-monitoring

* 'task-manager/docs-monitoring' of github.com:gmmorris/kibana: (120 commits)
  Bump the CI Node.js version from 14.15.4 to 14.16.0 (elastic#92578)
  [Uptime] Search made easy (elastic#88581)
  [Lens] Stop requesting stats on Records field (elastic#92508)
  [APM] Correlations style polish in prep for release (elastic#92514)
  [Lens] Fix sorting undefined, null and NaN values (elastic#92575)
  Put environment back in uiFilters (elastic#92561)
  [Discover] Fix sorting by _score behavior (elastic#92132)
  Add metricbeat steps to jenkins_build_load_testing.sh (elastic#90290)
  [Usage Collection] Remove unused UI Metric APIs (elastic#91620)
  Fix timelion deprecation documentation links (elastic#92576)
  [TSVB] Enable `dual mode`, support index patterns and strings (elastic#92395)
  Fix text align in Safari (elastic#92374)
  [Actions][Doc] Clean up Actions README (elastic#91789)
  chore(NA): add missing files to exclude when building bazel prod packages (elastic#92506)
  [Security Solution][Endpoint][Admin] Match Policy Details in Security Solution with Fleet (elastic#92047)
  Revert "[build] Add task skips intended for partial builds (elastic#92076)"
  [Enterprise Search] Change icon for error in EuiCallouts (elastic#92527)
  [Alerts][Docs] Alert types doc update. Added refs to applications specific alerts groups. (elastic#91787)
  [Security Solution][Exceptions] - Update exceptions modal to use existing lists plugin useApi hook (elastic#92348)
  [DOCS] Updates refresh text in index pattern doc (elastic#92469)
  ...
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:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.12.0 v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants