# How to handle document relations using nest elastic search

**URL:** <https://discuss.elastic.co/t/how-to-handle-document-relations-using-nest-elastic-search/21620>\
**Category:** Elasticsearch\
**Created:** [January 13, 2015, 11:12pm UTC](https://discuss.elastic.co/t/how-to-handle-document-relations-using-nest-elastic-search/21620 "2015-01-13T23:12:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bvnagaraju](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@bvnagaraju](https://discuss.elastic.co/u/bvnagaraju)\
**Post date:** [January 13, 2015, 11:12pm UTC](https://discuss.elastic.co/t/how-to-handle-document-relations-using-nest-elastic-search/21620/1 "2015-01-13T23:12:38Z")

</div>

Hi ,

I have a scenario where I have below document structure

Document { Id, Name,ParentId,FamilyId,Author,List of additional user custom  
fields }

and a document can have relations to another document .

For example :

we have mail thread where replies and actual mail are documents but actual  
mail is the parent and all the replies are child's.

Now have below use cases to achieve.

1)Get the qualified replies only for the given query .

2)Get the qualified replies and all other emails in thread (include  
families ) for given query.Here query meant to qualify the reply /replies

3)Get the qualified mail documents only for given query

4)Get the qualified mail documents and all of its replies for given query  
which qualifies the mail documents

can you let me know what is the best way to handle this kind of document  
relations and sample code for the nest client use .

Regards,  
Nagaraju

--  
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/d1c2b978-c971-4913-8e21-377c382bc52f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d1c2b978-c971-4913-8e21-377c382bc52f%40googlegroups.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:39am UTC](https://discuss.elastic.co/t/how-to-handle-document-relations-using-nest-elastic-search/21620/2 "2017-07-06T00:39:11Z")

</div>

Closed on July 6, 2017, 12:39am UTC


