mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-12 07:02:10 +00:00
parent
a7185b1b84
commit
8c5ff92cd2
@ -332,6 +332,8 @@ public final class MappingParameters {
|
||||
|
||||
if (!Similarity.Default.equals(similarity)) {
|
||||
objectNode.put(FIELD_PARAM_SIMILARITY, similarity);
|
||||
// similarity must have index explicitly set, otherwise Elasticsearch returns an error
|
||||
objectNode.put(FIELD_PARAM_INDEX, index);
|
||||
}
|
||||
|
||||
if (termVector != TermVector.none) {
|
||||
|
@ -263,6 +263,12 @@ public abstract class MappingBuilderIntegrationTests extends MappingContextBaseT
|
||||
indexOps.createWithMapping();
|
||||
}
|
||||
|
||||
@Test // #2659
|
||||
@DisplayName("should write correct mapping for dense vector property")
|
||||
void shouldWriteCorrectMappingForDenseVectorProperty() {
|
||||
operations.indexOps(SimilarityEntity.class).createWithMapping();
|
||||
}
|
||||
|
||||
// region Entities
|
||||
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
||||
static class Book {
|
||||
@ -893,5 +899,14 @@ public abstract class MappingBuilderIntegrationTests extends MappingContextBaseT
|
||||
@Nullable
|
||||
@Field(name = "dotted.field", type = Text) private String dottedField;
|
||||
}
|
||||
|
||||
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
||||
static class SimilarityEntity {
|
||||
@Nullable
|
||||
@Id private String id;
|
||||
|
||||
@Field(type = FieldType.Dense_Vector, dims = 42, similarity = "cosine") private double[] denseVector;
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user