# Elasticsearch | Relationship based Index

**URL:** <https://discuss.elastic.co/t/elasticsearch-relationship-based-index/171080>\
**Category:** Elasticsearch\
**Created:** [March 6, 2019, 10:23am UTC](https://discuss.elastic.co/t/elasticsearch-relationship-based-index/171080 "2019-03-06T10:23:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikesh/32/86579_2.png) [@Nikesh](https://discuss.elastic.co/u/Nikesh)\
**Post date:** [March 6, 2019, 10:23am UTC](https://discuss.elastic.co/t/elasticsearch-relationship-based-index/171080/1 "2019-03-06T10:23:38Z")

</div>

Hi,

I need to provide One-to-Many relationships in my index.  
example: Team and its players.  
Both of the above would contain similar fields.  
There would be constant updations or inclusion on new players to existing team.  
What is the most suitable method to store this type of data structure?  
Please note, Players are part of Team. So any search matched in any of the players would be considered as a match in Team.

---

<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:** [March 6, 2019, 11:30am UTC](https://discuss.elastic.co/t/elasticsearch-relationship-based-index/171080/2 "2019-03-06T11:30:55Z")

</div>

Elasticsearch is not a relation system although you can use the `join` feature.

But, let's talk about the use case first.  
What are your users going to search for? Players? Teams? Both? Note that a team and a player are not identical objects.  
What are the typical questions they want to ask to the system? Which attributes do they need to search for Players (or Teams)?

---

<div class="post-metadata">

**Author:** ![Nikesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikesh/32/86579_2.png) [@Nikesh](https://discuss.elastic.co/u/Nikesh)\
**Post date:** [March 6, 2019, 11:49am UTC](https://discuss.elastic.co/t/elasticsearch-relationship-based-index/171080/3 "2019-03-06T11:49:10Z")

</div>

Users can search on either Players or Teams or on both.  
Let's assume player and teams are identical objects

---

<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:** [March 6, 2019, 12:03pm UTC](https://discuss.elastic.co/t/elasticsearch-relationship-based-index/171080/4 "2019-03-06T12:03:36Z")

</div>

> Users can search on either Players or Teams or on both.

Which means that users will see both results all merged, with sometimes players, sometimes teams mixed in the same page result.

You did not answer to this question though:

> What are the typical questions they want to ask to the system? Which attributes do they need to search for Players (or Teams)?

---

<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:** [April 3, 2019, 12:03pm UTC](https://discuss.elastic.co/t/elasticsearch-relationship-based-index/171080/5 "2019-04-03T12:03:42Z")

</div>

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