ElasticSearch RoutingMissingException

Joh*_*ith 11 elasticsearch symfony-2.3 foselasticabundle

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

[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
        ...
Run Code Online (Sandbox Code Playgroud)

不能理解我在这里失踪的东西....

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

小智 20

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

在您的示例中,您需要尝试:

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

  • 使用Query DSL时仍然如此吗? (2认同)

Joh*_*ith 0

映射中有拼写错误。

comment:
    mappings:
        article_id: <-- was "article"
            type: long
            index: not_analyzed
Run Code Online (Sandbox Code Playgroud)

也许这对某人有帮助:)