Skip to content

Conversation

@benwtrent
Copy link
Member

@mayya-sharipova discovered that applying int sort optimizations unveils a subtle bug with missing values and sorted docvalue queries.

Since this isn't yet a bug that anybody can run into (exposed only when doing int optimized sorting), flagging as a non-issue.

This applies the fix in ES for application in: #127968

The main change here is adjusting all our usages of IndexSortSortedNumericDocValuesRangeQuery to use the copied XIndexSortSortedNumericDocValuesRangeQuery

Additionally, in Lucene 10, there are usages in LongField.newRangeQuery and IntField.newRangeQuery, so, to keep from using IndexSortSortedNumericDocValuesRangeQuery in those instances, usage of those static methods has been replaced with a new group of static methods.

I also added an assert in the XIndexSortSortedNumericDocValuesRangeQuery to force the removal of this query once we upgrade to a new Lucene minor. We don't want this short cut to rot.

NOTE: for the backport, I will have to adjust significantly the IndexSortSortedNumericDocValuesRangeQuery (copying from Lucene 9) as there are various changes in the 10 branch to IndexSortSortedNumericDocValuesRangeQuery that we don't want to accidentally apply. I will open a separate PR for review there.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label May 30, 2025
Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up on this, @benwtrent.

The change LGTM

@benwtrent benwtrent marked this pull request as draft May 30, 2025 13:37
@benwtrent
Copy link
Member Author

Converting to draft, we may never need this as we are looking into bug fix apache lucene releases.

@benwtrent benwtrent marked this pull request as ready for review June 2, 2025 12:33
@benwtrent benwtrent merged commit 2a44166 into elastic:main Jun 2, 2025
18 checks passed
@benwtrent benwtrent deleted the bugfix/correct-mixed-scalar-numeric-sort-queries branch June 2, 2025 13:54
benwtrent added a commit to benwtrent/elasticsearch that referenced this pull request Jun 2, 2025
* Applying Apache Lucene fix: apache/lucene#14732

* fixing test

* fixing annot

(cherry picked from commit 2a44166)
@benwtrent
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
9.0
8.19

Questions ?

Please refer to the Backport tool documentation

benwtrent added a commit to benwtrent/elasticsearch that referenced this pull request Jun 2, 2025
elasticsearchmachine pushed a commit that referenced this pull request Jun 2, 2025
…128765)

This adds the buggy functions to forbidden API check. Will remove once
Lucene is updated.

Related #128671
mridula-s109 pushed a commit that referenced this pull request Jun 2, 2025
* Applying Apache Lucene fix: apache/lucene#14732

* fixing test

* fixing annot
mridula-s109 pushed a commit that referenced this pull request Jun 2, 2025
…128765)

This adds the buggy functions to forbidden API check. Will remove once
Lucene is updated.

Related #128671
elasticsearchmachine pushed a commit that referenced this pull request Jun 2, 2025
…8764)

* Applying Apache Lucene fix: apache/lucene#14732 (#128671)

* Applying Apache Lucene fix: apache/lucene#14732

* fixing test

* fixing annot

(cherry picked from commit 2a44166)

* [CI] Auto commit changes from spotless

* adding forbidden api check

---------

Co-authored-by: elasticsearchmachine <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Jun 2, 2025
)

* Applying Apache Lucene fix: apache/lucene#14732 (#128671)

* Applying Apache Lucene fix: apache/lucene#14732

* fixing test

* fixing annot

(cherry picked from commit 2a44166)

* adding forbidden APIs check
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jun 3, 2025
* Applying Apache Lucene fix: apache/lucene#14732

* fixing test

* fixing annot
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jun 3, 2025
…8671) (elastic#128765)

This adds the buggy functions to forbidden API check. Will remove once
Lucene is updated.

Related elastic#128671
joshua-adams-1 pushed a commit to joshua-adams-1/elasticsearch that referenced this pull request Jun 3, 2025
* Applying Apache Lucene fix: apache/lucene#14732

* fixing test

* fixing annot
joshua-adams-1 pushed a commit to joshua-adams-1/elasticsearch that referenced this pull request Jun 3, 2025
…8671) (elastic#128765)

This adds the buggy functions to forbidden API check. Will remove once
Lucene is updated.

Related elastic#128671
thecoop added a commit to thecoop/elasticsearch that referenced this pull request Jun 4, 2025
Samiul-TheSoccerFan pushed a commit to Samiul-TheSoccerFan/elasticsearch that referenced this pull request Jun 5, 2025
* Applying Apache Lucene fix: apache/lucene#14732

* fixing test

* fixing annot
Samiul-TheSoccerFan pushed a commit to Samiul-TheSoccerFan/elasticsearch that referenced this pull request Jun 5, 2025
…8671) (elastic#128765)

This adds the buggy functions to forbidden API check. Will remove once
Lucene is updated.

Related elastic#128671
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :Search Relevance/Search Catch all for Search Relevance Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v8.19.0 v9.0.3 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants