Parent-Child relationship using join

Hi everyone,
I'm using ES 5.6 and I created an index with the single_type setting set to true with a join field as the following:

"join_field": {
    "type": "join",
    "eager_global_ordinals": true,
    "relations": {
        "doc": "child"
    }
}

Now I want to perform a query on the parent document and to make an aggregation on a field in its child.
With the previous version of ES I would do something like this:

{
  "query": {
    "has_parent": {
      "parent_type": "doc",
      "query": {
        "term": {
          "content": {
            "value": "a_word_to_search"
          }
        }
      }
    }
  }, 
  "aggs": {
    "name_1": {
       "terms": {
           "field": "child_field",
           "size": 2
       }
    }
  },
  "size": 0
}

The problem is that now, with the new join field, the has_parent query does not work anymore.
How can I perform the same query with the new ES features?

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