SpringBoot整合elasticsearch问题,导入数据时是为啥会自动创建我没加@Filed注解的字段?
< 返回列表时间: 2020-03-21来源:开源中国
HDC调试需求开发(15万预算),能者速来!>>>
我使用下面的依赖整合elasticsearch。 < dependency > < groupId > org.springframework.boot </ groupId > < artifactId > spring-boot-starter-data-elasticsearch </ artifactId > </ dependency >
bean类: @Document ( indexName = "bookshop" , type = "book" , shards = 1 , replicas = 0 ) public class Book { @Id private Integer id ; @Field ( type = FieldType . Text , analyzer = "ik_max_word" ) private String name ; @TableField ( exist = false ) private Category category ; private int type ; @Field ( type = FieldType . Keyword , index = false ) private double price ; @TableField ( value = "originalPrice" ) private double originalPrice ; @TableField ( exist = false ) private User user ; @Field ( type = FieldType . Keyword ) private String author ;
使用的是 ElasticsearchTemplate
创建索引,
导入数据是使用的 ElasticsearchRepository
导入数据时会把我不需要的字段存进elastissearch,为啥?
热门排行