Skip to content

Commit 7e74cf5

Browse files
committed
fix serialization and test
1 parent c557fb3 commit 7e74cf5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

server/src/main/java/org/elasticsearch/search/vectors/RescoreVectorBuilder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import static org.elasticsearch.TransportVersions.RESCORE_VECTOR_ALLOW_ZERO;
2727
import static org.elasticsearch.TransportVersions.RESCORE_VECTOR_ALLOW_ZERO_BACKPORT_8_19;
28-
import static org.elasticsearch.TransportVersions.V_9_0_0;
2928

3029
public class RescoreVectorBuilder implements Writeable, ToXContentObject {
3130

@@ -61,7 +60,7 @@ public void writeTo(StreamOutput out) throws IOException {
6160
// We don't want to serialize a `0` oversample to a node that doesn't know what to do with it.
6261
if (oversample == NO_OVERSAMPLE
6362
&& out.getTransportVersion().before(RESCORE_VECTOR_ALLOW_ZERO)
64-
&& (out.getTransportVersion().between(RESCORE_VECTOR_ALLOW_ZERO_BACKPORT_8_19, V_9_0_0) == false)) {
63+
&& (out.getTransportVersion().isPatchFrom(RESCORE_VECTOR_ALLOW_ZERO_BACKPORT_8_19) == false)) {
6564
throw new ElasticsearchStatusException(
6665
"[rescore_vector] does not support a 0 for ["
6766
+ OVERSAMPLE_FIELD.getPreferredName()

server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -932,14 +932,17 @@ public void testRescoreVectorOldIndexVersion() {
932932
}
933933

934934
public void testRescoreZeroVectorOldIndexVersion() {
935-
IndexVersion incompatibleVersion = IndexVersionUtils.randomVersionBetween(
936-
random(),
935+
IndexVersion incompatibleVersion = randomFrom(
937936
IndexVersionUtils.randomVersionBetween(
938937
random(),
939938
IndexVersionUtils.getLowestReadCompatibleVersion(),
940939
IndexVersionUtils.getPreviousVersion(IndexVersions.RESCORE_PARAMS_ALLOW_ZERO_TO_QUANTIZED_VECTORS_BACKPORT_8_X)
941940
),
942-
IndexVersionUtils.getPreviousVersion(IndexVersions.RESCORE_PARAMS_ALLOW_ZERO_TO_QUANTIZED_VECTORS)
941+
IndexVersionUtils.randomVersionBetween(
942+
random(),
943+
IndexVersions.UPGRADE_TO_LUCENE_10_0_0,
944+
IndexVersionUtils.getPreviousVersion(IndexVersions.RESCORE_PARAMS_ALLOW_ZERO_TO_QUANTIZED_VECTORS)
945+
)
943946
);
944947
for (String indexType : List.of("int8_hnsw", "int8_flat", "int4_hnsw", "int4_flat", "bbq_hnsw", "bbq_flat")) {
945948
expectThrows(

0 commit comments

Comments
 (0)