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

Incorrect sorting on numeric columns in Discover #69109

Closed
lo78cn opened this issue Jun 13, 2020 · 6 comments
Closed

Incorrect sorting on numeric columns in Discover #69109

lo78cn opened this issue Jun 13, 2020 · 6 comments
Labels
Feature:Discover Discover Application feedback_needed Team:Visualizations Visualization editors, elastic-charts and infrastructure triage_needed

Comments

@lo78cn
Copy link

lo78cn commented Jun 13, 2020

Kibana version: 7.7.0 and 7.7.1

Elasticsearch version: 7.7.0 and 7.7.1

Server OS version: Debian 10.4

Browser version:

  • Firefox 77.0.1, Brave Version 1.9.80
  • Chromium: 81.0.4044.138 (Official Build) (64-bit)
  • Safari 13.1.1

Browser OS version: MacOS 10.15.5

Original install method (e.g. download page, yum, from source, etc.): apt packages

Describe the bug: When I click/sort on any numeric column, the order is not correct

Steps to reproduce:

  1. create any Elasticsearch index that has one or more numeric fields (type: long)
  2. create a Kibana index
  3. create a discover view (add several columns including a numeric column)
    (by default sorted on timestamp)
  4. click on column name to sort ascending
  5. click on column name to sort descending

Expected behavior: correct numeric order

Screenshots (if relevant):

sorted on timestamp (default order)
image

time column ascending
image

time descending
image

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Any additional context:
Elasticsearch index mapping for this field:

"time": {
"type": "long"
}

Kibana index pattern field settings:

type: number
format: Number

@streamich streamich added Team:Visualizations Visualization editors, elastic-charts and infrastructure triage_needed labels Jun 15, 2020
@elasticmachine
Copy link
Contributor

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

@lo78cn
Copy link
Author

lo78cn commented Jun 30, 2020

Issue still exists in Elasticsearch and Kibana 7.8.0 release.

@timroes timroes added the Feature:Discover Discover Application label Jul 1, 2020
@timroes
Copy link
Contributor

timroes commented Jul 1, 2020

Hi @lo78cn,

could you please go to "Inspect" in the menubar and provide the request that's send to Elasticsearch?

Cheers,
Tim

@lo78cn
Copy link
Author

lo78cn commented Jul 1, 2020

Hi @timroes, please find the request inspect files attached.

time_asc.json.txt
time_desc.json.txt
initial_sort.json.txt

Looks like this is caused by "unmapped_type": "boolean".

@kertal
Copy link
Member

kertal commented Jul 1, 2020

Thanks for the files. @lo78cn
A time ago multisort was implemented in Discover. So you could sort by several fields

#41918

What seems to happen in your case is, that when you click on a new column to sort by , this column is added to the sort. so its

  1. sorting by the time field
  2. sorting on the column you clicked on

If you want just to sort by the new column, you have to deactivate sorting by it by clicking on the sort icon of it's column:

image

@lo78cn
Copy link
Author

lo78cn commented Jul 1, 2020

Hi @kertal, thank you for your explanation.

Now I know, why I did not notice this useful multisort feature. We have a field called msg.timestamp that is being used as the @timestamp field in the Kibana index pattern. In this case, the first field In the discover view automatically is called Time. After the initial sorting, no icons are visible. When I click on the secondary sort field msg.time. The sort icon is only visible on the msg.time field. The request inspect reveals that the query is sorted by both @timestamp and msg.time though.

It only happens in existing discover views that have been created in 7.6.x. If I create a new discover view in 7.8.0, this default Time field does initially show the sort icon.

I could add the field @timefield to see the initial sorting. I can't delete the default field Time. Having those two fields, next to each other, looks kind of strange.

The real work-a-round here seems to be to recreate and replace my existing discover views.

existing discover views

image

image

new discover view

image

@lo78cn lo78cn closed this as completed Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Discover Discover Application feedback_needed Team:Visualizations Visualization editors, elastic-charts and infrastructure triage_needed
Projects
None yet
Development

No branches or pull requests

5 participants