# Nested Document Search Query (searching across filtered nested documents)

**URL:** <https://discuss.elastic.co/t/nested-document-search-query-searching-across-filtered-nested-documents/262420>\
**Category:** Elasticsearch\
**Created:** [January 27, 2021, 9:38pm UTC](https://discuss.elastic.co/t/nested-document-search-query-searching-across-filtered-nested-documents/262420 "2021-01-27T21:38:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![suy1993](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@suy1993](https://discuss.elastic.co/u/suy1993)\
**Post date:** [January 27, 2021, 9:38pm UTC](https://discuss.elastic.co/t/nested-document-search-query-searching-across-filtered-nested-documents/262420/1 "2021-01-27T21:38:43Z")

</div>

I have nested document like  
{id:123,  
name:"abc",  
attendance[{class: "physics", Joined: "2021-01- 21", "grade": "pass"}  
, {class: "chemistry", Joined: "2021-01- 13", "grade": "NA"}, {class: "maths", Joined: "2021-01- 18", "grade": "fail"}]}  
I need to search for documents which have a user attending a physics class in last week from today, (i.e between 20th and 27 )and who hasnt attended any other class between a week from the day he had attended that physics class (here in this example between 14 - 20th jan, since physics class was attended on 21st jan)

---

<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:** [February 24, 2021, 9:38pm UTC](https://discuss.elastic.co/t/nested-document-search-query-searching-across-filtered-nested-documents/262420/2 "2021-02-24T21:38:45Z")

</div>

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