# Parent-child-grandchild relationship in Elasticsearch6

**URL:** https://discuss.elastic.co/t/parent-child-grandchild-relationship-in-elasticsearch6/163638
**Category:** Elasticsearch
**Created:** [January 10, 2019, 1:04am UTC](https://discuss.elastic.co/t/parent-child-grandchild-relationship-in-elasticsearch6/163638 "2019-01-10T01:04:34Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![srividya](https://avatars.discourse-cdn.com/v4/letter/s/ed8c4c/32.png) [@srividya](https://discuss.elastic.co/u/srividya)
#### Post date: [January 10, 2019, 1:04am UTC](https://discuss.elastic.co/t/parent-child-grandchild-relationship-in-elasticsearch6/163638/1 "2019-01-10T01:04:34Z")

</div>

Is there any way that we can implement the below mappings/scenario in elasticsearch 6?  
A {id}  
B (Child of A){id, parentid}  
C (Child of B){id, parentid}  
D(Child of A){id, parentid}

Since types are deprecated from version 6. Do we need to create all the above four as indices?  
How can we query A to get all documents (including its children & grandchildren) with id=xxx

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 7, 2019, 1:04am UTC](https://discuss.elastic.co/t/parent-child-grandchild-relationship-in-elasticsearch6/163638/2 "2019-02-07T01:04:36Z")

</div>

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