# Parent query?

**URL:** <https://discuss.elastic.co/t/parent-query/75650>\
**Category:** Elasticsearch\
**Created:** [February 19, 2017, 8:56pm UTC](https://discuss.elastic.co/t/parent-query/75650 "2017-02-19T20:56:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![billnbell](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@billnbell](https://discuss.elastic.co/u/billnbell)\
**Post date:** [February 19, 2017, 8:56pm UTC](https://discuss.elastic.co/t/parent-query/75650/1 "2017-02-19T20:56:54Z")

</div>

How do I get all "one" \_ids who has parent of referenceOne?

i.e. "referenceOne/one"

Here is the data.

What I want is "0000015a-5819-d3ce-afda-5bbb77040000". I thought maybe a terms query would work, but I am not seeing it. There might be more than one \_id if there are more than 1 "one"

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html#query-dsl-terms-lookup](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html#query-dsl-terms-lookup)

{  
"took": 1,  
"timed\_out": false,  
"\_shards": {  
"total": 5,  
"successful": 5,  
"failed": 0  
},  
"hits": {  
"total": 4,  
"max\_score": 1,  
"hits": [  
{  
"\_index": "index1",  
"\_type": "0000015a-5818-d3ce-afda-5bbacfea0002",  
"\_id": "0000015a-5819-d3ce-afda-5bbb769e0000",  
"\_score": 1,  
"\_source": {}  
},  
{  
"\_index": "index1",  
"\_type": "0000015a-5818-d3ce-afda-5bbacfea0002",  
"\_id": "0000015a-5819-d3ce-afda-5bbb76d50000",  
"\_score": 1,  
"\_source": {  
"referenceOne": {  
"\_ref": "0000015a-5819-d3ce-afda-5bbb769e0000",  
"\_type": "0000015a-5818-d3ce-afda-5bbacfea0002"  
}  
}  
},  
{  
"\_index": "index1",  
"\_type": "0000015a-5818-d3ce-afda-5bbacfea0002",  
"\_id": "0000015a-5819-d3ce-afda-5bbb77040000",  
"\_score": 1,  
"\_source": {  
"one": {  
"x": 0,  
"y": 0,  
"\_location": "0.0,0.0"  
}  
}  
},  
{  
"\_index": "index1",  
"\_type": "0000015a-5818-d3ce-afda-5bbacfea0002",  
"\_id": "0000015a-5819-d3ce-afda-5bbb773e0000",  
"\_score": 1,  
"\_source": {  
"referenceOne": {  
"\_ref": "0000015a-5819-d3ce-afda-5bbb77040000",  
"\_type": "0000015a-5818-d3ce-afda-5bbacfea0002"  
}  
}  
}  
]  
}  
}

---

<div class="post-metadata">

**Author:** ![billnbell](https://avatars.discourse-cdn.com/v4/letter/b/eb8c5e/32.png) [@billnbell](https://discuss.elastic.co/u/billnbell)\
**Post date:** [February 19, 2017, 10:23pm UTC](https://discuss.elastic.co/t/parent-query/75650/2 "2017-02-19T22:23:55Z")

</div>

I want to get all the ids, not just one... For example this query is not what I want, since it kinda defeats the purpose.

GET /index1/0000015a-5818-d3ce-afda-5bbacfea0002/\_search  
{  
"size": 1000,  
"query": {  
"bool": {  
"should": [  
{  
"terms": {  
"\_id": {  
"index": "index1",  
"type": "0000015a-5818-d3ce-afda-5bbacfea0002",  
"id": "0000015a-5819-d3ce-afda-5bbb773e0000",  
"path": "referenceOne.\_ref"  
}  
}  
},  
{  
"terms": {  
"\_id": {  
"index": "index1",  
"type": "0000015a-5818-d3ce-afda-5bbacfea0002",  
"id": "0000015a-5819-d3ce-afda-5bbb76d50000",  
"path": "referenceOne.\_ref"  
}  
}  
}  
]  
}  
}  
}

---

<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:** [March 19, 2017, 10:24pm UTC](https://discuss.elastic.co/t/parent-query/75650/3 "2017-03-19T22:24:32Z")

</div>

Closed on March 19, 2017, 10:24pm UTC

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