如何设置父/子关系

时间:2017-04-19 02:54:03

标签: php elasticsearch lumen elasticsearch-5

我试图创建两个文档,一个构建另一个文档的子项。我的映射配置就像这样

'mappings' => [
        "roadType" => [
            "properties" => [
            ]
        ],
        "carType" => [
            "_parent" => [
                "type" => "roadType"
            ],
            "properties" => [
                "make" => [
                    "type" => "string"
                ],
                "model" => [
                    "type" => "string"
                ]
            ]
        ]
    ]

我收到此错误消息。

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"No handler for type [roadType] declared on field [_parent]"}],"type":"mapper_parsing_exception","reason":"No handler for type [roadType] declared on field [_parent]"},"status":400}

有没有人有任何想法。谢谢

P / s我的Elasticsearch版本是5.3.0,我正在使用此包https://github.com/basemkhirat/elasticsearch与Elasticsearch进行通信。

更新1

我发现了这个问题。父和子的映射必须创建相同的时间,并且包的工作方式就像它们在更新映射时将逐个项发送到Elasticsearch服务器。这会导致错误。当父类型存在时,我必须找出如何创建子类型

0 个答案:

没有答案
相关问题