# How to receive child docID on has\_child query

**URL:** https://discuss.elastic.co/t/how-to-receive-child-docid-on-has-child-query/6890
**Category:** Elasticsearch
**Created:** [March 5, 2012, 11:56am UTC](https://discuss.elastic.co/t/how-to-receive-child-docid-on-has-child-query/6890 "2012-03-05T11:56:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vineeth\_mohan](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@vineeth\_mohan](https://discuss.elastic.co/u/vineeth_mohan)
#### Post date: [March 5, 2012, 11:56am UTC](https://discuss.elastic.co/t/how-to-receive-child-docid-on-has-child-query/6890/1 "2012-03-05T11:56:03Z")

</div>

Hi ,

I placed this query -

{  
"query": {  
"has\_child": {  
"type": "child",  
"query": {  
"term": {  
"names": "srijith"  
}  
}  
}  
}  
}

And recieved

{

- took: 1
- timed\_out: false
- \_shards: {
  - total: 2
  - successful: 2
  - failed: 0  
}

- hits: {
  - total: 1
  - max\_score: 1
  - hits: [
    - {
      - \_index: algotree
      - \_type: parent
      - \_id: aa8GhCZyRr6FjRigMF4GAQ
      - \_score: 1
      - \_source: {
        - names: algotree  
}  
}  
]  
}

}

Here the result is fine , but i was expecting the child result to be  
combined with the parent.  
Or at-least it will help if i get child docID.  
How can i do it ?

Thanks  
Vineeth

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [March 5, 2012, 3:30pm UTC](https://discuss.elastic.co/t/how-to-receive-child-docid-on-has-child-query/6890/2 "2012-03-05T15:30:57Z")

</div>

No, there ins't an option to get the child documents as part of the results. You only get the parents that matched.

On Monday, March 5, 2012 at 1:56 PM, Vineeth Mohan wrote:

> Hi ,
> 
> I placed this query -
> 
> {  
> "query": {  
> "has\_child": {  
> "type": "child",  
> "query": {  
> "term": {  
> "names": "srijith"  
> }  
> }  
> }  
> }  
> }
> 
> And recieved
> 
> {  
> took: 1  
> timed\_out: false  
> \_shards: {  
> total: 2  
> successful: 2  
> failed: 0
> 
> }  
> hits: {  
> total: 1  
> max\_score: 1  
> hits: [  
> {  
> \_index: algotree  
> \_type: parent  
> \_id: aa8GhCZyRr6FjRigMF4GAQ  
> \_score: 1  
> \_source: {  
> names: algotree
> 
> }
> 
> }
> 
> ]
> 
> }
> 
> }
> 
> Here the result is fine , but i was expecting the child result to be combined with the parent.  
> Or at-least it will help if i get child docID.  
> How can i do it ?
> 
> Thanks  
> Vineeth

---

<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, 3:37am UTC](https://discuss.elastic.co/t/how-to-receive-child-docid-on-has-child-query/6890/3 "2017-07-06T03:37:18Z")

</div>


