# Storing a graph of data in an index

**URL:** <https://discuss.elastic.co/t/storing-a-graph-of-data-in-an-index/67682>\
**Category:** Elasticsearch\
**Created:** [November 30, 2016, 9:41pm UTC](https://discuss.elastic.co/t/storing-a-graph-of-data-in-an-index/67682 "2016-11-30T21:41:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MatthewHartz](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@MatthewHartz](https://discuss.elastic.co/u/MatthewHartz)\
**Post date:** [November 30, 2016, 9:41pm UTC](https://discuss.elastic.co/t/storing-a-graph-of-data-in-an-index/67682/1 "2016-11-30T21:41:54Z")

</div>

Hi,

I'm still pretty novice in regards to Elasticsearch. Currently in our sql server database, we are creating "connections" between a certain entity. For example we have a person table, and we have another table called personConnection, which has 2 foreign keys to the person table. Each entry will "connect" the users together.

So my question is what is the best way to model this in Elasticsearch while minimizing complexity on updating records. Originally I was creating the person document that contained a list of connections which basically stored the id of the other person it was connected to (and some other metadata).

Doing this is it easily do-able to query the connections to see if i'm connected to a search of "joe" instead of the id of 5?

Let me know if this doesn't make sense,

Thanks!

---

<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:** [November 30, 2016, 10:14pm UTC](https://discuss.elastic.co/t/storing-a-graph-of-data-in-an-index/67682/2 "2016-11-30T22:14:39Z")

</div>

You can do this sort of structure then build the graph with our Graph plugin 🙂

---

<div class="post-metadata">

**Author:** ![MatthewHartz](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@MatthewHartz](https://discuss.elastic.co/u/MatthewHartz)\
**Post date:** [November 30, 2016, 10:25pm UTC](https://discuss.elastic.co/t/storing-a-graph-of-data-in-an-index/67682/3 "2016-11-30T22:25:39Z")

</div>

🙂 Unfortunately I'm running on the free license atm and the trial expired. For this type of structure do i need to make sure i'm using parent\_child mappings?

Thanks!

---

<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 28, 2016, 10:25pm UTC](https://discuss.elastic.co/t/storing-a-graph-of-data-in-an-index/67682/4 "2016-12-28T22:25:59Z")

</div>

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