12

我正在尝试填充具有父子关系的对象,但出现错误:

[Elastica\Exception\ResponseException] RoutingMissingException[[myindex]/[comment]/[12345] 需要路由]

conf类型的摘录:

article:
    _source:
        enabled: false
    mappings:
        ...

comment:
    _source:
        enabled: false
    _parent:
        type: article
        property: article_id
        identifier: id
    _routing:
        required: true
        path: article_id
    mappings:
        article:
            type: long
            index: not_analyzed
        ...

无法理解我在这里缺少什么....

我正在使用 Symfony2.3、FOSElasticaBundle 3.0、ElasticSearch 1.2.2

4

2 回答 2

21

当您有父子关系时,每次尝试访问子节点时都需要在 URL 中指定父节点,因为路由现在取决于父节点。

在您的示例中,您想尝试:

http://example.com/myindex/comment/12345 ?parent=[article_id]

于 2014-07-25T21:54:10.037 回答
0

映射中有错字。

comment:
    mappings:
        article_id: <-- was "article"
            type: long
            index: not_analyzed

也许这对某人有帮助:)

于 2014-07-21T12:31:33.113 回答