0

I'm trying to create two documents, one build a child of the other. My mapping config is like this

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

I got this error message .

{"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}

Does anyone have any idea. Thank you

P/s My Elasticsearch version is 5.3.0 and I am using this package https://github.com/basemkhirat/elasticsearch to communicate with Elasticsearch.

Update 1

I have found the problem. The mapping for parent and child must create same time, and the package works like they will sent one by one item to Elasticsearch server when update mapping. this will cause error. I have to find out how to create a child type when parent type is exist

ToujouAya
  • 593
  • 5
  • 24
  • Can you provide JSON data sent to ElasticSearch? – Random Apr 19 '17 at 04:30
  • I have found the problem. The mapping for parent and child must created same time, and the package works like they will sent one by one item to Elasticsearch server when update mapping. this cause error. – ToujouAya Apr 19 '17 at 06:09

0 Answers0