# Has\_parent search query sometimes working sometimes not

**URL:** <https://discuss.elastic.co/t/has-parent-search-query-sometimes-working-sometimes-not/11204>\
**Category:** Elasticsearch\
**Created:** [March 19, 2013, 9:33am UTC](https://discuss.elastic.co/t/has-parent-search-query-sometimes-working-sometimes-not/11204 "2013-03-19T09:33:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eran\_Eidinger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eran_eidinger/32/44831_2.png) [@Eran\_Eidinger](https://discuss.elastic.co/u/Eran_Eidinger)\
**Post date:** [March 19, 2013, 9:33am UTC](https://discuss.elastic.co/t/has-parent-search-query-sometimes-working-sometimes-not/11204/1 "2013-03-19T09:33:57Z")

</div>

A has\_parent query returns no hits, although a reverse query fits.

I have two mappings.  
The parent:  
{  
"album" :  
{  
"properties":  
{  
"title": { "type": "string"},  
"location": location,  
}  
}  
}

The child:  
{  
"photo" :  
{  
"\_parent": {"type": "album"},  
"properties":  
{  
"photo\_id": { "type": "string", "index" : "not\_analyzed" },  
"url": {"type": "string", "index" : "not\_analyzed" },  
}  
}  
}

Running a simple query, expected to return all the photos, returns nothing. Such as:  
{  
"query": {  
"has\_parent": {  
"parent\_type": "album",  
"query": {  
"match\_all": {}  
}  
}  
}  
}

Sometimes this works and sometimes not. Is "Has\_parent" experimental? Why would it sometime work and sometime not?  
Resetting the service and reinserting the data seems to work sometimes.

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 19, 2013, 12:45pm UTC](https://discuss.elastic.co/t/has-parent-search-query-sometimes-working-sometimes-not/11204/2 "2013-03-19T12:45:12Z")

</div>

> Sometimes this works and sometimes not. Is "Has\_parent" experimental? Why  
> would it sometime work and sometime not?  
> Resetting the service and reinserting the data seems to work sometimes.

It should work. Can you gist a full recreation and open an issue  
please? Also version of ES that you're using

ta

clint

--  
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:45am UTC](https://discuss.elastic.co/t/has-parent-search-query-sometimes-working-sometimes-not/11204/3 "2017-07-06T02:45:47Z")

</div>


