elasticsearch 2.0 parent child grandchild

后端 未结 2 1502
再見小時候
再見小時候 2021-01-23 02:30

My operation:

parent: country, child: branch, grandchild: employee

PUT /company { \"mappings\": { \"branch\": { \"_parent\": {

相关标签:
2条回答
  • Ok I have found the problem - you cannot create parent-child relation with an existing type after deleting the index all was fine

    0 讨论(0)
  • 2021-01-23 03:09

    This is a restriction imposed in elasticsearch 2.0. This is mentioned in breaking changes in 2.0. However the reason behind this this is not clear in the document.

    Below is what martijnvg an elasticsearch developer posted on elasticsearch discuss threads:

    a new child type can't point to an existing type as parent.

    This has to do with the fact that with the new parent/child implementation both parent and child types store ids in a join field. If type becomes a parent after it has been created then parent documents may have been indexed that didn't store their id in the join field. For this reason this restriction exists.

    This only applies for new indices created after the upgrade to ES 2.0. For migration purposes this restriction doesn't apply for indices created before the upgrade to ES 2.0. In fact on created on ES 1.x and before the old parent/child implementation is being used.

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

    0 讨论(0)
提交回复
热议问题