# Visualizing parent-child relations

**URL:** <https://discuss.elastic.co/t/visualizing-parent-child-relations/23804>\
**Category:** Kibana\
**Created:** [June 17, 2015, 6:27am UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804 "2015-06-17T06:27:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![amos](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@amos](https://discuss.elastic.co/u/amos)\
**Post date:** [June 17, 2015, 6:27am UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/1 "2015-06-17T06:27:33Z")

</div>

Hi ,

I have created an index with parent/child relations  
(following this example: [https://www.elastic.co/guide/en/elasticsearch/guide/current/indexing-parent-child.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/indexing-parent-child.html) )

POST /company/branch/\_bulk  
{ "index": { _"\_id": "london"_ }}  
{ "name": "London Westminster", "city": "London", **"country": "UK"** }

POST /company/employee/\_bulk  
{ "index": { "\_id": 2, _"parent": "london"_ }}  
{ "name": "Mark Thomas", "dob": "1982-05-16", **"hobby": "diving"** }

How can I create a Kibana graph of hobby distribution by country  
(combine parent and child data)

thanks  
Amos

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [June 17, 2015, 7:05am UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/2 "2015-06-17T07:05:32Z")

</div>

KB doesn't do P/C at the moment sorry!

---

<div class="post-metadata">

**Author:** ![amos](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@amos](https://discuss.elastic.co/u/amos)\
**Post date:** [June 17, 2015, 7:09am UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/3 "2015-06-17T07:09:57Z")

</div>

Thanks Mark,

So what are the alternatives ? change the index into a nested structure

what is the best alternative ?

thanks  
amos

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [June 17, 2015, 4:17pm UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/4 "2015-06-17T16:17:24Z")

</div>

You can flatten the structure into a single level document, or you can use nested documents with "include\_in\_parent" mapping, which virtually does the same thing. The latter workaround described in this issue: [https://github.com/elastic/kibana/issues/1084](https://github.com/elastic/kibana/issues/1084)

---

<div class="post-metadata">

**Author:** ![christian\_pirngruber](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@christian\_pirngruber](https://discuss.elastic.co/u/christian_pirngruber)\
**Post date:** [June 22, 2015, 1:57pm UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/5 "2015-06-22T13:57:42Z")

</div>

Hi,

Any plans on inluding P/C aggregation in Kibana any time soon?

In our case (translated to the branch/employee example) we cannot "nest" all employees within the branch document, because we add many new employees (belonging to one branch) to the index and it seems to me that would be too many updates on the branch document, if we can't handle them as different documents.

BR,  
Christian

---

<div class="post-metadata">

**Author:** ![cherah30](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@cherah30](https://discuss.elastic.co/u/cherah30)\
**Post date:** [September 11, 2015, 12:21pm UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/6 "2015-09-11T12:21:32Z")

</div>

That is to say Document = a series of strings ("key", "value") where key and a value is a simples strings( without any structure).

Accepting this hypothesis, is forget the only benefit of "DOCUMENT" compared to a classic table of BDDr ...  
Is not there something wrong !!!

---

<div class="post-metadata">

**Author:** ![rastro](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@rastro](https://discuss.elastic.co/u/rastro)\
**Post date:** [December 14, 2016, 10:52pm UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/7 "2016-12-14T22:52:26Z")

</div>

Is there a github issue we can follow for this? (I couldn't find one...)

p.s. "The last reply to this topic is now over 460 days old"...

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 14, 2016, 11:34pm UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/8 "2016-12-14T23:34:43Z")

</div>

[https://github.com/elastic/kibana/issues/1084](https://github.com/elastic/kibana/issues/1084) is the best one AFAIK.

> [@rastro](#):
>
> p.s. "The last reply to this topic is now over 460 days old"...

These are forums, not Github issues 🙂

---

<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:** [July 6, 2017, 1:33pm UTC](https://discuss.elastic.co/t/visualizing-parent-child-relations/23804/9 "2017-07-06T13:33:43Z")

</div>


