# Problem with nested objects

**URL:** <https://discuss.elastic.co/t/problem-with-nested-objects/7547>\
**Category:** Elasticsearch\
**Created:** [May 3, 2012, 9:01am UTC](https://discuss.elastic.co/t/problem-with-nested-objects/7547 "2012-05-03T09:01:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thanuja\_gandhi](https://avatars.discourse-cdn.com/v4/letter/t/dc4da7/32.png) [@thanuja\_gandhi](https://discuss.elastic.co/u/thanuja_gandhi)\
**Post date:** [May 3, 2012, 9:01am UTC](https://discuss.elastic.co/t/problem-with-nested-objects/7547/1 "2012-05-03T09:01:10Z")

</div>

Hi All,

I am using the following json for a document having multiple parents and  
each parent having multiple childs . Is there any way to get child ids for  
a single parent id?

I can able to get parent ids and child ids separately. But I am in need of  
child ids corresponding to the parent . Can anyone help?

"tag":{  
"type" : "nested", "store" : "yes", "index" : "not\_analyzed", "omit\_norms"  
: "true",  
"include\_in\_parent":true,  
"properties":{  
"parentid":{"type" : "integer", "store" : "yes", "precision\_step" : "8" },  
"childtag":{  
"type" : "nested", "store" : "yes", "index" : "not\_analyzed",  
"omit\_norms" : "true",  
"include\_in\_parent":true,  
"properties":{  
"childid":{"type" : "integer", "store" : "yes", "precision\_step" : "8" }  
}  
}  
}  
}

Please correct me if I am wrong. Thanks in advance!

Regards,  
Thanuja

---

<div class="post-metadata">

**Author:** ![Tatireddy\_Reddy](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@Tatireddy\_Reddy](https://discuss.elastic.co/u/Tatireddy_Reddy)\
**Post date:** [August 16, 2016, 4:02am UTC](https://discuss.elastic.co/t/problem-with-nested-objects/7547/2 "2016-08-16T04:02:49Z")

</div>

By using parent child relationship you can.

Ex:{  
"query": {

```
"has_child": {
  "type": "TYPE",
  "query": {
    "match": {
      "FIELD": "TEXT"
    }
  }
}

```

}  
}

---

<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 5, 2017, 10:27pm UTC](https://discuss.elastic.co/t/problem-with-nested-objects/7547/3 "2017-07-05T22:27:37Z")

</div>


