根据官方elasticsearch的说法,我了解到,如果进行添加/删除/更新操作,嵌套需要重新索引父对象及其所有子对象,因此当需要进行大量修改时,代价会很高。
使用嵌套的示例:
@Document(indexName = "test-index-person-multiple-level-nested", type = "user", shards = 1, replicas = 0, refreshInterval = "-1")
public class PersonMultipleLevelNested {
@Id
private String id;
private String name;
@Field(type = FieldType.Nested)
private List<GirlFriend> girlFriends;
//Getter, setter & constructor
}
和Parent & Child更适合这种情况,但是我如何使用Spring Data Elasticsearch进行设置?还不支持吗?似乎找不到相关文档。
发布于 2017-08-14 05:54:17
我不确定文档,但是有一个针对这个特性的单元测试:https://github.com/spring-projects/spring-data-elasticsearch/blob/master/src/test/java/org/springframework/data/elasticsearch/entities/ParentEntity.java --请特别查看@Parent
。
https://stackoverflow.com/questions/45659171
复制相似问题