# How to query nested documents in order

**URL:** <https://discuss.elastic.co/t/how-to-query-nested-documents-in-order/15250>\
**Category:** Elasticsearch\
**Created:** [January 15, 2014, 5:17pm UTC](https://discuss.elastic.co/t/how-to-query-nested-documents-in-order/15250 "2014-01-15T17:17:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andr\_e](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@Andr\_e](https://discuss.elastic.co/u/Andr_e)\
**Post date:** [January 15, 2014, 5:17pm UTC](https://discuss.elastic.co/t/how-to-query-nested-documents-in-order/15250/1 "2014-01-15T17:17:21Z")

</div>

Does anyone know how to query all documents that has nested document that  
match a certain query.

Say you have a blog post with comments that are nested and you want to find  
all blog post comments that a comment contains help and following comments  
after that contains thank you in insertion order or by date. Which will  
also me to see all post that had questions and were answered.

Thanks.

--  
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/97e39d44-dc1d-425b-9851-64d99b2fb941%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/97e39d44-dc1d-425b-9851-64d99b2fb941%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 1:56am UTC](https://discuss.elastic.co/t/how-to-query-nested-documents-in-order/15250/2 "2017-07-06T01:56:40Z")

</div>


