I created two Spring-Data elasticsearch repositories for two parent/child related documents. You can see the document classes for both of them here.
The repositories are getting instantiated in XML with the help of repositories element like this
<elasticsearch:repositories base-package="com.acme.repositories" />
You can find a complete example of the issue in this github repo. My source code is based in the tests found in spring-data-elasticsearch repo. The source code consists of just two domain classes(parent,child), the related repositories, the xml configuration files and a unit test class.
Clone and run mvn test
, throws java.lang.IllegalArgumentException: can't add a _parent field that points to an already existing type, that isn't already a parent
It seems that this parent/child relationship produces an elastic search exception which is clear in the Elasticsearch side, but I do not know how to prevent this from happening when executing the Spring Data test.