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 tab should sort by score when index pattern doesn't contain time-based data #3973

Closed
babadofar opened this issue May 24, 2015 · 5 comments · Fixed by #4466
Closed
Assignees

Comments

@babadofar
Copy link

When using the discover tab for searching data without timestamp, result are not sorted by score. The index-pattern is created without timestamp, and the query response from Elasticsearch is sorted by score (can be seen by inspecting the results in javascript debugger) . Some custom score seems to be applied as the results are displayed.
Using Kibana 4.0.2, also tried using latest from github.

@rashidkpc
Copy link
Contributor

Results are sorted by score by default. Can you show me an example of this not happening? Kibana explicitly asks for _score sort by default on indices without a time.

{"size":500,"sort":{"_score":"desc"},"query":{"query_string":{"analyze_wildcard":true,"query":"*"}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fields":{"*":{}},"fragment_size":2147483647},"fields":["*","_source"],"script_fields":{},"fielddata_fields":["@timestamp","relatedContent.article:modified_time","utc_time","relatedContent.article:published_time"]}

Its possible that Kibana will display the in a slightly different order than returned by elasticsearch if there are documents that are scored exactly the same, however in that case elasticsearch's order is more happenstance than anything else.

@babadofar
Copy link
Author

I just tried to create a small test case and of course everything worked as it should, results being sorted by relevance. So this must be something else weird with my setup?

What's particularly funny when looking at the original test data, is that hit number 1 always has a very low score, while hit number 2 is really number 1. Could it be some kind of one off paging bug?

@rashidkpc
Copy link
Contributor

nope, kibana doesn't do any paging. Do you have a data set that replicates the incorrect behavior reliably?

@babadofar
Copy link
Author

Tried again, starting on a fresh install, using default Logstash mapping. Searching for "India pale ale" in the discover panel returns an item with score 0.147 at the top position, hit 2 has score 1.18, same score for hit 3.
I made a snapshot of the full index, together with the .kibana index. It's a 7MB file at google drive
here:
https://drive.google.com/file/d/0Bxb4jjpDGsn7WkFWRmZCdWg3aUk/view?usp=sharing

@babadofar
Copy link
Author

The snapshot contains indexes that reproduces the bug. It contains a .kibana index and a testvinmonopolet index which contains the data.

Just to be clear, I know that you know this already, but here is the procedure for restoring the snapshot 😄
Download the snapshot at https://drive.google.com/file/d/0Bxb4jjpDGsn7WkFWRmZCdWg3aUk/view?usp=sharing
untar the folder in a convenient location on your machine. It will create subfolder /var/elasticbackup_new in the directory you chose.
Next, in elasticsearch, create a new repository
PUT /_snapshot/somesemirandomname { "type": "fs", "settings": { "location": "this is where you type in your backup folder and add /var/elasticbackup_new", "compress": true } }

The snapshot name inside the backup is snapshot_kibana_weird_sortThen to restore you do
POST /_snapshot/somesemirandomname/snapshot_kibana_weird_sort/_restore
In the discover tab, search for "india pale ale". Unless something magically got fixed on the way, you will see that the first hit has a quite low score, while hit number two has max score and should have been at the top. If your search returns less than 10 hits, the bug doesn't seem to appear, but can't say for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants