-
Notifications
You must be signed in to change notification settings - Fork 882
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
Remove RunId from visibility query sort for ES 7 #3140
Conversation
@@ -65,7 +65,6 @@ const ( | |||
var defaultSorter = []elastic.Sorter{ | |||
elastic.NewFieldSort(searchattribute.CloseTime).Desc().Missing("_first"), | |||
elastic.NewFieldSort(searchattribute.StartTime).Desc().Missing("_first"), | |||
elastic.NewFieldSort(searchattribute.RunID).Desc().Missing("_first"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to change setDefaultFieldSort
too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just read PR description. I believe it should be removed from setDefaultFieldSort
in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried and I feel we should not do it. So I reverted the change. There are two reasons:
(1) We are disabling user specified orderby by default. This is not an issue if that's not turned on.
(2) If user intentionally turn it on, then removing the RunId as tie-breaker can cause a behavior change, if user does not specify all tie-breakers in order by (very likely the case, e.g. if they order by some custom search attributes with low cardinality).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default value for disable ORDER BY is false
. But I agree that if custom order is specified then query is already slow. Adding RunId
won't hurt much.
3ced517
to
689dae3
Compare
2d6e714
to
6c4c509
Compare
What changed?
Remove
RunId
from visibility query sort for ES v7.Why?
Improve query performance
How did you test it?
Manually sending queries to ES
Potential risks
Duplicate or missing entries when doing pagination.
Although this is unlikely because both closed time and start time has nano seconds precision in ES v7.
For ES v6 this is not changed because date has only milliseconds precision and collisions are more likely.
Is hotfix candidate?
Could be.