Elasticsearch 2.0 parent grandson of a grandson

My operation:

parent: country, child: branch, grandson: employee

PUT / company {"mappings": {"branch": {"_parent": {"type": "country"}}, "hired worker": {"_parent": {"type": "branch"}}} }

I want to add employee grandson2, parent branch:

PUT / company / employee2 / _mapping {"employee2": {"_parent": {"type": "branch"}}}

I get the wrong message:

{"error": {"main reason": [{"type": "illegal_argument_exception", "reason": "cannot add the _parent field indicating the already existing type"}], "type": "illegal_argument_exception", " reason ":" cannot add the _parent field indicating the already existing type "}," status ": 400}

I do not know how I can do this. Any suggestions? Thank you

+2
parent elasticsearch
source share
1 answer

This is a limitation introduced in elasticsearch 2.0. This is mentioned in violation of the changes in version 2.0 . However, the reason for this is not clear in the document.

The following is a martijnvg elasticsearch developer hosted on elasticsearch discussing topics:

A new child type cannot point to an existing type as a parent.

This is due to the fact that with the new parent / child element, the implementation of both the parent and child types stores identifiers in the union field. If the type becomes a parent after it is created, then the parent may have indexed documents that did not store their identifier in the connection field. For this reason, this limitation exists.

This only applies to new indexes created after upgrading to ES 2.0. For migration purposes, this restriction does not apply to indexes created before upgrading to ES 2.0. Actually on created on ES 1.x and before using the old parent / child implementation.

You can read about it here: https://discuss.elastic.co/t/adding-child-types-in-2-0/33267

+8
source share

All Articles