我使用spring-data-elasticsearch(https://github.com/spring-projects/spring-data-elasticsearch),我有两个实体类:
@Document(indexName = "aa", type = "aa", shards = 5, replicas = 1, refreshInterval = "-1", indexStoreType = "memory")
class AA {
@Id
private Long Id;
private BB bb;
private String field1;
// ... Many more Fields.
// ... getters and setters
}
@Document(indexName = "bb", type = "bb", shards = 5, replicas = 1, refreshInterval = "-1", indexStoreType = "memory")
class BB {
@Id
private Long Id;
private BB bbParent;
// ... Many more Fields.
// ... getters and setters
}
当我保存到AA存储库
时aaRepository.save(aa);
我有一些奇怪的行为:当bbParent为null时,一切都很好,但是当设置bbParent时,保存需要更长时间(> 100倍)。
你有任何提示吗?