Skip to content

Commit 4439b0d

Browse files
committed
Enhance Elasticsearch String field mapping
Fix #29311
1 parent d2446c4 commit 4439b0d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

generators/spring-data-elasticsearch/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.elastic_search.ejs

+6-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333
<%_ if (field.fieldIsEnum) { _%>
3434
@org.springframework.data.elasticsearch.annotations.Field(type = org.springframework.data.elasticsearch.annotations.FieldType.Keyword)
3535
<%_ } else if (field.blobContentTypeText || field.fieldTypeString) { _%>
36-
@org.springframework.data.elasticsearch.annotations.Field(type = org.springframework.data.elasticsearch.annotations.FieldType.Text)
36+
@org.springframework.data.elasticsearch.annotations.MultiField(
37+
mainField = @org.springframework.data.elasticsearch.annotations.Field(type = org.springframework.data.elasticsearch.annotations.FieldType.Text),
38+
otherFields = {
39+
@org.springframework.data.elasticsearch.annotations.InnerField(suffix = "keyword", type = org.springframework.data.elasticsearch.annotations.FieldType.Keyword)
40+
}
41+
)
3742
<%_ } else if (field.fieldTypeBoolean) { _%>
3843
@org.springframework.data.elasticsearch.annotations.Field(type = org.springframework.data.elasticsearch.annotations.FieldType.Boolean)
3944
<%_ } else if (field.fieldTypeInteger) { _%>

0 commit comments

Comments
 (0)