我的操作:
父母:国家,子女:分支机构,孙子:员工
PUT / company {“mappings”:{“branch”:{“_ parent”:{“type”:“country”}},“employee”:{“_ parent”:{“type”:“branch”}}} }
我想添加一个孙子employee2,父亲是分支:
PUT / company / employee2 / mapping {“employee2”:{“ parent”:{“type”:“branch”}}}
我收到错误的消息:
{“error”:{“root_cause”:[{“type”:“illegal_argument_exception”,“reason”:“无法添加指向已存在类型的_parent字段”},“type”:“illegal_argument_exception “,”“reason”:“无法添加指向已存在类型的_parent字段”},“status”:400}
我不知道该怎么办 . 有什么建议吗?谢谢 .
2 回答
这是elasticsearch 2.0中的限制 . 这在breaking changes in 2.0中提到 . 然而,这背后的原因在文件中并不清楚 .
以下是elasticsearch开发人员在elasticsearch上讨论线程的martijnvg:
你可以在这里阅读:https://discuss.elastic.co/t/adding-child-types-in-2-0/33267
好的,我发现了问题 - 删除索引后,您无法使用现有类型创建父子关系