Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -565,9 +565,6 @@ tests:
- 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
- class: org.elasticsearch.index.mapper.vectors.DenseVectorFieldMapperTests
method: testExistsQueryMinimalMapping
issue: https://github.com/elastic/elasticsearch/issues/129911

# Examples:
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

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;
Expand Down Expand Up @@ -147,7 +148,17 @@ private void indexMapping(XContentBuilder b, IndexVersion indexVersion) throws I

@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<Float> convertToList(float[] vector) {
List<Float> list = new ArrayList<>(vector.length);
for (float v : vector) {
list.add(v);
}
return list;
}

@Override
Expand Down