嵌套文档 & Parent/Child 使用 Spring Boot + Spring Data Elasticsearch 设置
Nested document & Parent/Child setup using Spring Boot + Spring Data Elasticsearch
根据官方 elasticsearch,我了解到如果 add/delete/update 操作,嵌套需要重新索引父项及其所有子项,因此在需要大量修改时会很昂贵。
使用嵌套的示例:
@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 进行设置?还不支持?好像找不到相关的文档。
根据官方 elasticsearch,我了解到如果 add/delete/update 操作,嵌套需要重新索引父项及其所有子项,因此在需要大量修改时会很昂贵。
使用嵌套的示例:
@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 进行设置?还不支持?好像找不到相关的文档。