Skip to content

Commit

Permalink
Fix missing element_type when using elasticsearch-java 8.14.x
Browse files Browse the repository at this point in the history
Original Pull Request #2928
Closes #2927
  • Loading branch information
puppylpg authored Jun 12, 2024
1 parent d101eeb commit d9d1b73
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldElementType;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.KnnAlgorithmType;
import org.springframework.data.elasticsearch.annotations.KnnIndexOptions;
Expand Down Expand Up @@ -142,12 +143,7 @@ static class VectorEntity {
@Nullable
@Field(type = Keyword) private String message;

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

Expand Down

0 comments on commit d9d1b73

Please sign in to comment.