# Searching on Nested Document indexes : not on Parent Object

**URL:** <https://discuss.elastic.co/t/searching-on-nested-document-indexes-not-on-parent-object/10996>\
**Category:** Elasticsearch\
**Created:** [March 4, 2013, 1:28pm UTC](https://discuss.elastic.co/t/searching-on-nested-document-indexes-not-on-parent-object/10996 "2013-03-04T13:28:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vimlesh\_Mishra](https://avatars.discourse-cdn.com/v4/letter/v/ecd19e/32.png) [@Vimlesh\_Mishra](https://discuss.elastic.co/u/Vimlesh_Mishra)\
**Post date:** [March 4, 2013, 1:28pm UTC](https://discuss.elastic.co/t/searching-on-nested-document-indexes-not-on-parent-object/10996/1 "2013-03-04T13:28:07Z")

</div>

I have following document structure in ES :

```
{
"text" : "OTesting3"
"otag" : "otag4"
"pages" : [{
      "text" : "1"
        "tagDTO" : {
            "name" : "itag2"
        }
    }, {
     "text" : "2"
        "tagDTO" : {
            "name" : "itag4"
        }
    }
]
}

```

also i mapped pages as nested document, now i able to use nested query on parent object as expected but my problem is :

I also want to search on pages documents only so example if i search on "pages.text" : "1" i should get only one page rather than both pages. I read in documentation that these nested objects will be stored as separate documents so is there any way to search on these separate document

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [March 25, 2013, 1:11pm UTC](https://discuss.elastic.co/t/searching-on-nested-document-indexes-not-on-parent-object/10996/2 "2013-03-25T13:11:55Z")

</div>

At the moment this isn't possible. If you had a match inside the nested  
object the whole document is returned as hit.

On 4 March 2013 14:28, Vimlesh Mishra [vimlesh.mishra@gmail.com](mailto:vimlesh.mishra@gmail.com) wrote:

> I have following document structure in ES :
> 
> ```
> {
> "text" : "OTesting3"
> "otag" : "otag4"
> "pages" : [{
> "text" : "1"
> "tagDTO" : {
> "name" : "itag2"
> }
> }, {
> "text" : "2"
> "tagDTO" : {
> "name" : "itag4"
> }
> }
> ]
> }
> 
> ```
> 
> also i mapped pages as nested document, now i able to use nested query on  
> parent object as expected but my problem is :
> 
> I also want to search on pages documents only so example if i search on  
> "pages.text" : "1" i should get only one page rather than both pages. I  
> read  
> in documentation that these nested objects will be stored as separate  
> documents so is there any way to search on these separate document
> 
> --  
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Searching-on-Nested-Document-indexes-not-on-Parent-Object-tp4030937.html](http://elasticsearch-users.115913.n3.nabble.com/Searching-on-Nested-Document-indexes-not-on-Parent-Object-tp4030937.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
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).  
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, 2:44am UTC](https://discuss.elastic.co/t/searching-on-nested-document-indexes-not-on-parent-object/10996/3 "2017-07-06T02:44:47Z")

</div>


