# ElasticSearch documents relationship question

**URL:** <https://discuss.elastic.co/t/elasticsearch-documents-relationship-question/22724>\
**Category:** Elasticsearch\
**Created:** [March 17, 2015, 10:07pm UTC](https://discuss.elastic.co/t/elasticsearch-documents-relationship-question/22724 "2015-03-17T22:07:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mithrawnuroudo](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@Mithrawnuroudo](https://discuss.elastic.co/u/Mithrawnuroudo)\
**Post date:** [March 17, 2015, 10:07pm UTC](https://discuss.elastic.co/t/elasticsearch-documents-relationship-question/22724/1 "2015-03-17T22:07:25Z")

</div>

Could you help me to model architecture of storing posts and comments in  
ElasticSearch?

Currenlty i have simple data structure - I store in ES "posts" as documents  
in ES index. I do search on that index to find posts with particular words.  
Posts are not related to anything. Every post has unique url and that's it.  
Simple.

I want to add possibility to store comments to post."Comments" will be  
special version of "posts" - comment has parent(other post) and comments  
have particular order between other comments of their parent. I wonder how  
should i model relationship between posts/comments and which ES data  
structure should i use. I don't know anything about documents relationship  
in Elasticsearch, so any help will be great.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/e262e145-3b1f-45f0-a374-a6b2dd8ad189%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e262e145-3b1f-45f0-a374-a6b2dd8ad189%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [March 17, 2015, 10:36pm UTC](https://discuss.elastic.co/t/elasticsearch-documents-relationship-question/22724/2 "2015-03-17T22:36:12Z")

</div>

Take a look at

> **[Handling Relationships | Elasticsearch: The Definitive Guide \[2.x\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/guide/current/relations.html)**

to get you started.

On 17 March 2015 at 15:07, Mithrawnuroudo [mojcalyspam@gmail.com](mailto:mojcalyspam@gmail.com) wrote:

> Could you help me to model architecture of storing posts and comments in  
> Elasticsearch?
> 
> Currenlty i have simple data structure - I store in ES "posts" as  
> documents in ES index. I do search on that index to find posts with  
> particular words. Posts are not related to anything. Every post has unique  
> url and that's it. Simple.
> 
> I want to add possibility to store comments to post."Comments" will be  
> special version of "posts" - comment has parent(other post) and comments  
> have particular order between other comments of their parent. I wonder how  
> should i model relationship between posts/comments and which ES data  
> structure should i use. I don't know anything about documents relationship  
> in Elasticsearch, so any help will be great.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/e262e145-3b1f-45f0-a374-a6b2dd8ad189%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e262e145-3b1f-45f0-a374-a6b2dd8ad189%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/e262e145-3b1f-45f0-a374-a6b2dd8ad189%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e262e145-3b1f-45f0-a374-a6b2dd8ad189%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAEYi1X9UMUeaXp%2BTa%2BGr9apsJeXCxtv8caMc9hhgdWx%3D\_mN--g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAEYi1X9UMUeaXp%2BTa%2BGr9apsJeXCxtv8caMc9hhgdWx%3D_mN--g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:26am UTC](https://discuss.elastic.co/t/elasticsearch-documents-relationship-question/22724/3 "2017-07-06T00:26:05Z")

</div>


