# Mapping Grandparent elasticsearch 6

**URL:** https://discuss.elastic.co/t/mapping-grandparent-elasticsearch-6/142221
**Category:** Elasticsearch
**Created:** [July 30, 2018, 4:21pm UTC](https://discuss.elastic.co/t/mapping-grandparent-elasticsearch-6/142221 "2018-07-30T16:21:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Guillaume\_Abautret](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@Guillaume\_Abautret](https://discuss.elastic.co/u/Guillaume_Abautret)
#### Post date: [July 30, 2018, 4:21pm UTC](https://discuss.elastic.co/t/mapping-grandparent-elasticsearch-6/142221/1 "2018-07-30T16:21:30Z")

</div>

Hi all,  
I need to map Grandparent-\>parent-\>child but I don't know how to do that. I only know how to define a parent child relationship with "join datatype" but that's all.  
Can you help me ?  
Thank you.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [August 2, 2018, 11:41am UTC](https://discuss.elastic.co/t/mapping-grandparent-elasticsearch-6/142221/2 "2018-08-02T11:41:54Z")

</div>

Hey,

you could try to have two different join fields (grandparent -\> parent and parent -\> child) in your mapping first and you also have to make sure that you index childs,parents and grandparent documents with the same routing value so they end up in the same shard.

Hope this helps.

--Alex

---

<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: [August 30, 2018, 11:49am UTC](https://discuss.elastic.co/t/mapping-grandparent-elasticsearch-6/142221/3 "2018-08-30T11:49:32Z")

</div>

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