diff --git a/muted-tests.yml b/muted-tests.yml index 9a9b7e1af7fa..a4b5a5ddade8 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -560,9 +560,6 @@ tests: - class: org.elasticsearch.xpack.rank.rrf.RRFRankClientYamlTestSuiteIT method: test {yaml=rrf/950_pinned_interaction/rrf with pinned retriever as a sub-retriever} issue: https://github.com/elastic/elasticsearch/issues/129845 -- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapperTests - method: testExistsQueryMinimalMapping - issue: https://github.com/elastic/elasticsearch/issues/129911 - class: org.elasticsearch.xpack.test.rest.XPackRestIT method: test {p0=esql/60_usage/Basic ESQL usage output (telemetry) non-snapshot version} issue: https://github.com/elastic/elasticsearch/issues/129888 @@ -571,6 +568,7 @@ tests: extractedAssemble, #2]" issue: https://github.com/elastic/elasticsearch/issues/119871 + # Examples: # # Mute a single test case in a YAML test suite: diff --git a/server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java index aaee6602a03a..8f17dfa8fd56 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapperTests.java @@ -65,6 +65,7 @@ import java.util.Set; import static org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat.DEFAULT_BEAM_WIDTH; import static org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsFormat.DEFAULT_MAX_CONN; +import static org.apache.lucene.tests.index.BaseKnnVectorsFormatTestCase.randomNormalizedVector; import static org.elasticsearch.index.codec.vectors.IVFVectorsFormat.DYNAMIC_NPROBE; import static org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper.DEFAULT_OVERSAMPLE; import static org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapper.IVF_FORMAT; @@ -147,7 +148,17 @@ public class DenseVectorFieldMapperTests extends MapperTestCase { @Override protected Object getSampleValueForDocument() { - return elementType == ElementType.FLOAT ? List.of(0.5, 0.5, 0.5, 0.5) : List.of((byte) 1, (byte) 1, (byte) 1, (byte) 1); + return elementType == ElementType.FLOAT + ? convertToList(randomNormalizedVector(this.dims)) + : List.of((byte) 1, (byte) 1, (byte) 1, (byte) 1); + } + + private static List convertToList(float[] vector) { + List list = new ArrayList<>(vector.length); + for (float v : vector) { + list.add(v); + } + return list; } @Override