-
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 sorting is inconsistent #49050
Comments
Pinging @elastic/kibana-app (Team:KibanaApp) |
Hi, thanks for that thorough issue description. I am unfortunately currently not able to reproduce that. Could you perhaps provide the following two additional information:
Thanks a lot for your engagement, cc @kertal |
@timroes
In the response, no, the hits are not sorted how I would expect. For example, heavily redacted:
|
Is there anything more I can provide to help get this issue resolved? Any suggested workarounds? This is having a substantial impact on my users. |
sorry for the delay, thanks for you patience and for the sample you provided, so you want to sort by event time but according to the result you've provided, you're sorting by
since we've introduced the feature to sort on multiple columns in kibana in 7.4, could this be a result of the changed sorting behavior: So when it's initially sorted by event time , you klick on another field, then this field is added to the sort fields with a lower priority. So I wonder if not the add-on of a field might be the cause, at least in the example you provided, it seems the result of the wrong sorting was caused by sorting on multiple columns |
@kertal Thank you for following up. The user intention in the case I provided is to sort on event_time, though they may be displaying other fields as well. I don't believe the other fields had been clicked to attempt to sort on multiple fields. For the test case I provided I tried to keep it simple. For my user the intent would be for the sort order of fields to be reversed from the demonstrated behavior in Kibana. The preferred order would have been:
|
I will check if there's a sorting issue in 7.4 but generally, in the example you've sent me there are 3 sort fields, and afaik it's not possible to set this without manual user input. since event_time is you most important field, why didn't you set it as |
Because we use the index pattern for lots of things other than the search that was done here. Regardless, when I did this, the only field I clicked on to sort was event_time. It really doesn't matter whether we use a time filter or not, once I've clicked one of the fields all sorting should be done by that field, and not by _score. |
I've run into this again and wanted to check and see if any additional feedback was needed from my end. It is clear that there is a problem with the sorter, especially when dealing with indexes that don't have a time filter and when trying to sort by a date field. This is a very common use case for us and something that we use daily. When looking at the request sent by Kibana to Elasticsearch it is clear that the request and the order of the sorters is not being properly updated for user's desired sorting based on they clicking of the sort arrows. Today I'm seeing a column that isn't even currently displayed as in the sort list, and the column I've clicked on to sort is last in the list. |
so I made a test in kibana 7.4.0 with the testdata that's provided with Kibana, so you could test it the same way
I've added an index pattern When I do this, it's automatically ordered by I click on the I'm adding another column I click on the timestamp sort icon, now it's sorted 1) by So it works as expected. But what I encountered later on, which could lead in the right direction was this: when I change to the index pattern Thx @JeffBolle for reporting this! |
Outstanding. I will say that our users are constantly switching between different index patterns and this could very well be why it was difficult to replace. That would also likely explain why a field was still in the sort that I wasn't currently using or displaying when I re-encountered this today. |
Looks like a bug caused by logic still hanging around from when multi-sort was not an option. It used to be that when the sorted column did not exist in the current index pattern, we'd default to the time field or _score, which was fine when you could only sort on one field at a time. Not sure what the most appropriate behavior would be here. In the example @kertal outlined, when switching to an index pattern that does not have |
To me, as a user, if I have just switched index patterns, I would expect the sorting to be "natural" (score, or by the time field if in an index pattern with a time filter). The previous sorting was for the previous index pattern. In my case, I switched index patterns, ran a query, and then clicked a column to sort, which had no impact. |
@Bargs I think we should switch to the default sort of the switched index pattern, don't think it's necessary to keep the sort "state". |
Well if the new index pattern has all of the necessary fields, I think we should retain the sort. The selected columns are also retained. That's how Kibana has behaved for a long time and it was intentional because some users have multiple index patterns with the same fields and they want to be able to compare back and forth without reconfiguring the columns and sort each time. If we did decide to reset the sort on index pattern change, then we should also reset the columns. |
@Bargs that's a good point not to change long time behavior, so a fundamental change should also take care of the columns. I've suggested a solution that should solve the problem @JeffBolle reported, removing the default sort after |
@JeffBolle those fields should be already filtered out, isn't that the case? |
@kertal Clearly I was mistaken. I had thought that had been mentioned as a possible issue as well, but I haven't been able to reproduce it. Sorry about that. |
Kibana version: 7.4.0
Elasticsearch version: 7.4.0
Server OS version: Ubuntu 16.04
Browser version: Google Chrome | 78.0.3904.70 (Official Build) (64-bit)
Browser OS version: ClearLinux 5.3.7-853.native (also OS X)
Original install method (e.g. download page, yum, from source, etc.): apt-get
Describe the bug:
When opening an index pattern without a time filter in the discover tab and choosing a timestamp field to sort on, sorting is out of order if a search term is provided. The initial search on loading the pattern and adding the field appears to be properly ordered. If additional fields are added to the table and some documents only have some of the fields displayed, the sorting appears to group some of the returned results, which within the grouping appear to be sorted correctly, but in the context of the entire result set, are not properly sorted.
Steps to reproduce:
Expected behavior:
Results are sorted by the requested field across all documents, regardless of matches, highlighting, and other fields in the documents.
Screenshots (if relevant):
Errors in browser console (if relevant):
Provide logs and/or server output (if relevant):
Any additional context:
In the second image I needed to redact our internal information, however you can see the timestamps that should be in decreasing order are effectively grouped. The second set of results does also appear to be sorted in decreasing order, but it is out of order for all results.
The text was updated successfully, but these errors were encountered: