Get parent field from join mapping

I have a join mapping relationship where units is the parent and wells is child.

I'm trying to run this query to return the child but also include a field from the parent. This would only return the parent ID. How do i return a field in the parent document called "name"?

{
  "query": {
    "parent_id": { 
      "type": "wells",
      "id": "units-1"
    }
  },
  "runtime_mappings": {
    "parent": {
      "type": "keyword",
      "script": "emit(doc['my_join_field#units'].value)"
    }
  },   
  "fields": [
    { "field": "parent" }
  ]
}

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