Spring Data Elasticsearch是否支持实体上的@Embedded注释?有人能指点我一个例子吗?
版本:spring-data-elasticsearch 2.1.4.RELEASE
这是我得到的错误:
failed to load elasticsearch nodes : org.elasticsearch.index.mapper.MapperParsingException: No type specified for field [address]
代码就是......
@Embedded
private Address address = new Address();
答案 0 :(得分:0)
@Embedded
注释来自javax.persistence.*
包,用于与底层关系模型进行映射。如果您需要在相同的elasticsearch文档中存储相关实体,请根据您的需要为elasticsearch添加其他注释:
@Field(type = FieldType.Object)
或
@Field(type = FieldType.Nested)