From 898dd47c938f5e9d05896fe20b7d53a64608990c Mon Sep 17 00:00:00 2001
From: Chris Hegarty <62058229+ChrisHegarty@users.noreply.github.com>
Date: Thu, 1 May 2025 14:24:42 +0100
Subject: [PATCH] Upgrade to Lucene 10.2.1 (#127343)
This commit upgrades to Lucene 10.2.1 (from a previous 10.2.1-SNAPSHOT).
Given that we're on a snapshot, there are a few things to note:
* No index version update is necessary, we already have IndexVersions.UPGRADE_TO_LUCENE_10_2_1, and there are no format changes in the final non-snapshot release.
---
build-tools-internal/version.properties | 2 +-
docs/changelog/127343.yaml | 5 +
gradle/verification-metadata.xml | 150 +++++++++---------
.../search/query/QueryPhaseTests.java | 11 +-
4 files changed, 89 insertions(+), 79 deletions(-)
create mode 100644 docs/changelog/127343.yaml
diff --git a/build-tools-internal/version.properties b/build-tools-internal/version.properties
index 29cd82ca60d8..24f1c603f928 100644
--- a/build-tools-internal/version.properties
+++ b/build-tools-internal/version.properties
@@ -1,5 +1,5 @@
elasticsearch = 9.1.0
-lucene = 10.2.1-snapshot-ae6484f43e6
+lucene = 10.2.1
bundled_jdk_vendor = openjdk
bundled_jdk = 24+36@1f9ff9062db4449d8ca828c504ffae90
diff --git a/docs/changelog/127343.yaml b/docs/changelog/127343.yaml
new file mode 100644
index 000000000000..3d3e12799d16
--- /dev/null
+++ b/docs/changelog/127343.yaml
@@ -0,0 +1,5 @@
+pr: 127343
+summary: Upgrade to Lucene 10.2.1
+area: Search
+type: upgrade
+issues: []
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 15e2b6df77f6..8d01a5d66bde 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -2951,129 +2951,129 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
diff --git a/server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java b/server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java
index 1f74668158e0..0d7f16211aa5 100644
--- a/server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java
+++ b/server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java
@@ -55,6 +55,7 @@ import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.TotalHits;
+import org.apache.lucene.search.TotalHits.Relation;
import org.apache.lucene.search.Weight;
import org.apache.lucene.search.join.BitSetProducer;
import org.apache.lucene.search.join.ScoreMode;
@@ -567,12 +568,13 @@ public class QueryPhaseTests extends IndexShardTestCase {
// size is lower than terminate_after
context.setSize(5);
// track_total_hits is lower than terminate_after
- context.trackTotalHitsUpTo(randomIntBetween(1, 6));
+ int trackTotalHits = randomIntBetween(1, 6);
+ context.trackTotalHitsUpTo(trackTotalHits);
QueryPhase.executeQuery(context);
// depending on docs distribution we may or may not be able to honor terminate_after: low scoring hits are skipped via
// setMinCompetitiveScore, which bypasses terminate_after until the next leaf collector is pulled, when that happens.
assertThat(context.queryResult().terminatedEarly(), either(is(true)).or(is(false)));
- assertThat(context.queryResult().topDocs().topDocs.totalHits.value(), equalTo(7L));
+ assertThat(context.queryResult().topDocs().topDocs.totalHits.value(), greaterThanOrEqualTo((long) trackTotalHits));
assertThat(context.queryResult().topDocs().topDocs.totalHits.relation(), equalTo(TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(5));
}
@@ -990,7 +992,10 @@ public class QueryPhaseTests extends IndexShardTestCase {
context.trackTotalHitsUpTo(5);
QueryPhase.addCollectorsAndSearch(context);
- assertEquals(10, context.queryResult().topDocs().topDocs.totalHits.value());
+ TotalHits totalHits = context.queryResult().topDocs().topDocs.totalHits;
+ assertThat(totalHits.value(), greaterThanOrEqualTo(5L));
+ var expectedRelation = totalHits.value() == 10 ? Relation.EQUAL_TO : Relation.GREATER_THAN_OR_EQUAL_TO;
+ assertThat(totalHits.relation(), is(expectedRelation));
}
}