Skip to content

Fix missing element_type when using elasticsearch-java 8.14.x #2928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all 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
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