Skip to content

Commit d9d1b73

Browse files
authored
Fix missing element_type when using elasticsearch-java 8.14.x
Original Pull Request #2928 Closes #2927
1 parent d101eeb commit d9d1b73

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/test/java/org/springframework/data/elasticsearch/repositories/knn/KnnSearchIntegrationTests.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.springframework.data.domain.Pageable;
3030
import org.springframework.data.elasticsearch.annotations.Document;
3131
import org.springframework.data.elasticsearch.annotations.Field;
32+
import org.springframework.data.elasticsearch.annotations.FieldElementType;
3233
import org.springframework.data.elasticsearch.annotations.FieldType;
3334
import org.springframework.data.elasticsearch.annotations.KnnAlgorithmType;
3435
import org.springframework.data.elasticsearch.annotations.KnnIndexOptions;
@@ -142,12 +143,7 @@ static class VectorEntity {
142143
@Nullable
143144
@Field(type = Keyword) private String message;
144145

145-
// TODO: `elementType = FieldElementType.FLOAT,` is to be added here later
146-
// TODO: element_type can not be set here, because it's left out in elasticsearch-specification
147-
// TODO: the issue is fixed in https://github.com/elastic/elasticsearch-java/pull/800, but still not released in
148-
// 8.13.x
149-
// TODO: will be fixed later by either upgrading to 8.14.0 or a newer 8.13.x
150-
@Field(type = FieldType.Dense_Vector, dims = 2,
146+
@Field(type = FieldType.Dense_Vector, dims = 2, elementType = FieldElementType.FLOAT,
151147
knnIndexOptions = @KnnIndexOptions(type = KnnAlgorithmType.HNSW, m = 16, efConstruction = 100),
152148
knnSimilarity = KnnSimilarity.COSINE) private float[] vector;
153149

0 commit comments

Comments
 (0)