-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Fix sort on date fields with missing values (#73763) #116099
Open
hanjongho
wants to merge
4
commits into
elastic:main
Choose a base branch
from
hanjongho:fix-73763
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pinging @elastic/es-search (Team:Search) |
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
external-contributor
Pull request authored by a developer outside the Elasticsearch team
:Search Foundations/Search
Catch all for Search Foundations
Team:Search Foundations
Meta label for the Search Foundations team in Elasticsearch
v9.1.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
hi @cbuescher, @jimczi
I'm trying to find and share the error in the logic of sort with missing, order method together in the date field.
while using

.missing("_last").sort(SortOrder.DESC)
indate
field (doc does not have a date field),sort value return
-9223372036854775808L
by the following logiccan simulate this case with this order
1. Put Index Settings
2. Bulk 2 documents that has
date_nanos
,date
type each3. Query with
.missing("_last").sort(SortOrder.DESC)
indate_nanos
field3.1 Actual Result
this works well, fixed in #74760
4. Query with
.missing("_last").sort(SortOrder.DESC)
indate
field4.1 Actual Result
Suggest
when I searched for the issues related to this error, I found #73763, which is the same issue about

date_nanos
.I checked the PR #74760 (commited by @cbuescher) for the issue. when I added the
date
type to the logic (PR) and tested it in my local,0L
responded well normally. and when I tested it with order asc, neededLong.MAX_VALUE
, elastic search's specification.please understand if there is something wrong in my explanation. review it when you have time.
thank you 👍