# Joining on Parent Child relations in Elasticsearch 6.0

**URL:** <https://discuss.elastic.co/t/joining-on-parent-child-relations-in-elasticsearch-6-0/108417>\
**Category:** Elasticsearch\
**Created:** [November 20, 2017, 3:45pm UTC](https://discuss.elastic.co/t/joining-on-parent-child-relations-in-elasticsearch-6-0/108417 "2017-11-20T15:45:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aravindh\_S](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@Aravindh\_S](https://discuss.elastic.co/u/Aravindh_S)\
**Post date:** [November 20, 2017, 3:45pm UTC](https://discuss.elastic.co/t/joining-on-parent-child-relations-in-elasticsearch-6-0/108417/1 "2017-11-20T15:45:48Z")

</div>

Hi, I have a question regarding how to model some data so that I can join two documents of different structure (Inside the same index differentiated by type field). My data structure is as follows:

1. SessionCreatedEvent which has the properties sessionId, locale, date-of-birth, type='SessionCreated' and
2. OrderPlaceEvent which also has sessionId, amount, type='OrderPlaced'.  
I need to get the total amount for all orders placed in a specific country. How should I model this data in ES6 to get the answer. The problem I am having is both of the above events are not necessarily a parent child typed ones. There can be more event types that are related only by sessionId.

On a side note, I know that kibana does not support visualizations with parent child relations. Is it possible to execute a normal elasticsearch query that uses parent child relations and then apply some graphing on the result of the query?

---

<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:** [December 18, 2017, 3:46pm UTC](https://discuss.elastic.co/t/joining-on-parent-child-relations-in-elasticsearch-6-0/108417/2 "2017-12-18T15:46:09Z")

</div>

Closed on December 18, 2017, 3:46pm UTC

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