2017-07-10 87 views
0

Spring Data Elasticsearch是否支持实体上的@Embedded注释?有人能指点我一个例子吗?Spring Data Elasticsearch支持@Embedded

版本:弹簧数据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

@Embedded注释来自javax.persistence.*包,用于与底层关系模型进行映射。如果你需要存储与实体同样的elasticsearch文档中添加额外的注释为elasticsearch,根据您的需要:

@Field(type = FieldType.Object) 

@Field(type = FieldType.Nested) 
相关问题