# About Elasticsearch Relationsship

**URL:** https://discuss.elastic.co/t/about-elasticsearch-relationsship/86435
**Category:** Elasticsearch
**Created:** [May 19, 2017, 1:49pm UTC](https://discuss.elastic.co/t/about-elasticsearch-relationsship/86435 "2017-05-19T13:49:12Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![venurai2000](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@venurai2000](https://discuss.elastic.co/u/venurai2000)
#### Post date: [May 19, 2017, 1:49pm UTC](https://discuss.elastic.co/t/about-elasticsearch-relationsship/86435/1 "2017-05-19T13:49:12Z")

</div>

Hi,  
In Mysql i am maintaining below tables and i created same document types in ES also.

1.Order: storing orders data,  
2. User\_Order: Storing orderId and userId.  
3.User: storing Users data.

Here i created Parent and child relation between Order(parent) and User\_Order(Child), When i give orderId i able to get there child records but the problem was i am not able to get Users information/fields, how can i solve this problem.

Appreciate if anyone give solution.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 19, 2017, 2:31pm UTC](https://discuss.elastic.co/t/about-elasticsearch-relationsship/86435/2 "2017-05-19T14:31:04Z")

</div>

And what about storing the user within the order document ?

---

<div class="post-metadata">

### Author: ![venurai2000](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@venurai2000](https://discuss.elastic.co/u/venurai2000)
#### Post date: [May 23, 2017, 1:41pm UTC](https://discuss.elastic.co/t/about-elasticsearch-relationsship/86435/3 "2017-05-23T13:41:51Z")

</div>

Hi,  
If I store user data in order again it's redundant, hence i stored user data in user type,In User\_Order i'm storing both ID's Like user Id and Order Id,how to join there three types.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 23, 2017, 2:45pm UTC](https://discuss.elastic.co/t/about-elasticsearch-relationsship/86435/4 "2017-05-23T14:45:56Z")

</div>

> [@venurai2000](#):
>
> If I store user data in order again it's redundant

And? Why do you think it's a problem?

> [@venurai2000](#):
>
> how to join there three types

You can't do join in elasticsearch. Or you can do some kind of join using parent/child feature but I'd not do it unless I really need to use that.  
Denormalizing data should be your first option.

---

<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: [June 20, 2017, 2:46pm UTC](https://discuss.elastic.co/t/about-elasticsearch-relationsship/86435/5 "2017-06-20T14:46:25Z")

</div>

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