Inner Hits including parent document


(Martin Lonský) #1

Is there possible to get work something like this? I've tried inner_hits also from parent to child, but still no effect.
ES 5.6
I thing, something is disabled, because inner_hits are not applied. I can not find whats wrong.
Mappings has _parent and documents are indexed with reference to parent. It works, because has_parent and has_child filter works as expected.

Whats wrong with inner hits? :confused:

{
  "index": "??",
  "size": 1,
  "body": {
    "query": {
      "has_parent": {
        "parent_type": "Parent",
        "inner_hits": {
          "name": "NameOfHits"
        }
      }
    }
  }
}

(Martijn Van Groningen) #2

That should work. Can you share your mappings?


(Martin Lonský) #3

Just simply set _parent mappings for child documents. Childs are indexed with parent ID value

'TicketFlow'             => [
    '_parent'    => [
        'type' => 'Ticket',
    ],
    '_routing'   => [
        'required' => true,
    ],
    'properties' => [...]
],

(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.