mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-15 08:32:18 +00:00
parent
a7185b1b84
commit
8c5ff92cd2
@ -332,6 +332,8 @@ public final class MappingParameters {
|
|||||||
|
|
||||||
if (!Similarity.Default.equals(similarity)) {
|
if (!Similarity.Default.equals(similarity)) {
|
||||||
objectNode.put(FIELD_PARAM_SIMILARITY, 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) {
|
if (termVector != TermVector.none) {
|
||||||
|
@ -263,6 +263,12 @@ public abstract class MappingBuilderIntegrationTests extends MappingContextBaseT
|
|||||||
indexOps.createWithMapping();
|
indexOps.createWithMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test // #2659
|
||||||
|
@DisplayName("should write correct mapping for dense vector property")
|
||||||
|
void shouldWriteCorrectMappingForDenseVectorProperty() {
|
||||||
|
operations.indexOps(SimilarityEntity.class).createWithMapping();
|
||||||
|
}
|
||||||
|
|
||||||
// region Entities
|
// region Entities
|
||||||
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
||||||
static class Book {
|
static class Book {
|
||||||
@ -893,5 +899,14 @@ public abstract class MappingBuilderIntegrationTests extends MappingContextBaseT
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Field(name = "dotted.field", type = Text) private String dottedField;
|
@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
|
// endregion
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user