basemkhirat / elasticsearch

The missing elasticsearch ORM for Laravel, Lumen and Native php applications
MIT License
401 stars 130 forks source link

How can I set a parent / child relationship #19

Open ToujouAya opened 7 years ago

ToujouAya commented 7 years ago

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 fie ld [_parent]"}],"type":"mapper_parsing_exception","reason":"No handler for type [roadType] declared on field [_pare nt]"},"status":400}

Does anyone have any idea. Thank you

FrostBy commented 7 years ago

@basemkhirat Could you please add parent_id param or something else to insert/etc, method?

jchatard commented 7 years ago

Yeah, it seems like adding a child document, referring to its parent is not supported by the syntax at the moment.

I'm using this library for 2 hours, so I don't know where to search to add this feature.