【发布时间】:2017-03-13 16:52:59
【问题描述】:
我为两个父/子相关文档创建了两个 Spring-Data elasticsearch 存储库。您可以看到它们的文档类here。
在这样的 repositories 元素的帮助下,存储库正在 XML 中实例化
<elasticsearch:repositories base-package="com.acme.repositories" />
您可以在this github repo 中找到该问题的完整示例。我的源代码基于spring-data-elasticsearch repo 中的测试。源代码仅包含两个域类(父、子)、相关存储库、xml 配置文件和一个unit test class。
克隆并运行mvn test,抛出java.lang.IllegalArgumentException: can't add a _parent field that points to an already existing type, that isn't already a parent
似乎这种父/子关系产生了一个弹性搜索异常,在Elasticsearch side 中很清楚,但我不知道在执行 Spring Data 测试时如何防止这种情况发生。
【问题讨论】:
标签: spring-data spring-data-elasticsearch