ElasticSearch RoutingMissingException
Asked Answered
H

2

12

I'm trying to populate objects having parent-child relation, but get an error:

[Elastica\Exception\ResponseException] RoutingMissingException[routing is required for [myindex]/[comment]/[12345]]

Excerpt from type 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
        ...

Cant understand what I am missing here....

I'm using Symfony2.3, FOSElasticaBundle 3.0, ElasticSearch 1.2.2

Hardtop answered 21/7, 2014 at 9:49 Comment(3)
Hello @JognSmith, could you please edit your answer and add the line of composer for the version of FOSElasticaBundle, show how your entities are mapped in the code? I'm under the same bug for more than 2 days and it is driving me crazy. Thanks!Safir
@Cassiano, my problem was incorrect field in mapping (as noted in my answer below). Corrected original question. Check your mapping.Hardtop
I've already checked that. That's why I was asking to you other stuff as composer tag/branch and association mapping in entitiesSafir
H
0

Had typo in mappings.

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

Maybe this helps someone :)

Hardtop answered 21/7, 2014 at 12:31 Comment(0)
P
21

When you have a parent child relationship, you need to specify the parent in the URL each time you try to access it a child, since routing now depends on the parent.

In your example, you'd want to try:

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

Pedestrian answered 25/7, 2014 at 21:54 Comment(1)
Is this still the case when using the Query DSL?Donau
H
0

Had typo in mappings.

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

Maybe this helps someone :)

Hardtop answered 21/7, 2014 at 12:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.