# Has\_child query on an alias

**URL:** <https://discuss.elastic.co/t/has-child-query-on-an-alias/18599>\
**Category:** Elasticsearch\
**Created:** [July 11, 2014, 12:16pm UTC](https://discuss.elastic.co/t/has-child-query-on-an-alias/18599 "2014-07-11T12:16:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pawel\_Krzaczkowski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pawel_krzaczkowski/32/1404_2.png) [@Pawel\_Krzaczkowski](https://discuss.elastic.co/u/Pawel_Krzaczkowski)\
**Post date:** [July 11, 2014, 12:16pm UTC](https://discuss.elastic.co/t/has-child-query-on-an-alias/18599/1 "2014-07-11T12:16:07Z")

</div>

Hi,

I don't know if this is a bug or it should work like that ... but it seems  
like a bug.

Let's say we have monthly indexes

...  
index\_1405  
index\_1406  
index\_1407  
...

All of them are assigned to an alias index\_year - that is pointing to last  
12 indexes.

We have two types

- question
- answer

question is a parent to answer.

Our query:

{  
"min\_score": 1,  
"query": {  
"function\_score": {  
"query": {  
"has\_child": {  
"query": {  
"match\_all": {}  
},  
"score\_mode" : "sum",  
"type": "answer"  
}  
}  
}  
}  
}

So sending this query to [http://127.0.0.1:9200/index\_year/\_search](http://127.0.0.1:9200/index_year/_search) return  
records only from last index - index\_1407

{  
"took" : 2,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 1,  
"successful" : 1,  
"failed" : 0  
},  
"hits" : {  
"total" :\* 3\*,  
"max\_score" : 4.0,  
"hits" : [...]  
}  
}

- 

Sending this query to  
[http://127.0.0.1:9200/index\_1405,index\_1406,index\_1407/\_search](http://127.0.0.1:9200/index_1405,index_1406,index_1407/_search) return  
results from all indxes.

{  
"took" : 3,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 2,  
"successful" : 2,  
"failed" : 0  
},  
"hits" : {  
"total" : _17_,  
"max\_score" : 4.0,  
"hits" : [....]  
}  
}

As You can see this one return 17 records .. from all indexes.

So my question is ... is there some kind of limit on has\_child query and  
aliases ??

Elasticsearch 1.2.1

Best ragards,  
Pawel

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/77c62bf9-7fb5-49c0-8330-0e9c3770bf4e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/77c62bf9-7fb5-49c0-8330-0e9c3770bf4e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Pawel\_Krzaczkowski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pawel_krzaczkowski/32/1404_2.png) [@Pawel\_Krzaczkowski](https://discuss.elastic.co/u/Pawel_Krzaczkowski)\
**Post date:** [July 11, 2014, 3:15pm UTC](https://discuss.elastic.co/t/has-child-query-on-an-alias/18599/2 "2014-07-11T15:15:54Z")

</div>

Hi,

My bad ... someone deleted aliases without my knowladge ... that's why it  
didn't work 🙂 it works as it should ... the problem was with alias  
definition 🙂

Pawel

W dniu piątek, 11 lipca 2014 14:16:08 UTC+2 użytkownik Paweł Krzaczkowski  
napisał:

> Hi,
> 
> I don't know if this is a bug or it should work like that ... but it seems  
> like a bug.
> 
> Let's say we have monthly indexes
> 
> ...  
> index\_1405  
> index\_1406  
> index\_1407  
> ...
> 
> All of them are assigned to an alias index\_year - that is pointing to last  
> 12 indexes.
> 
> We have two types
> 
> - question
> - answer
> 
> question is a parent to answer.
> 
> Our query:
> 
> {  
> "min\_score": 1,  
> "query": {  
> "function\_score": {  
> "query": {  
> "has\_child": {  
> "query": {  
> "match\_all": {}  
> },  
> "score\_mode" : "sum",  
> "type": "answer"  
> }  
> }  
> }  
> }  
> }
> 
> So sending this query to [http://127.0.0.1:9200/index\_year/\_search](http://127.0.0.1:9200/index_year/_search) return  
> records only from last index - index\_1407
> 
> {  
> "took" : 2,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 1,  
> "successful" : 1,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" :\* 3\*,  
> "max\_score" : 4.0,  
> "hits" : [...]  
> }  
> }
> 
> - 
> 
> Sending this query to  
> [http://127.0.0.1:9200/index\_1405,index\_1406,index\_1407/\_search](http://127.0.0.1:9200/index_1405,index_1406,index_1407/_search) return  
> results from all indxes.
> 
> {  
> "took" : 3,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 2,  
> "successful" : 2,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : _17_,  
> "max\_score" : 4.0,  
> "hits" : [....]  
> }  
> }
> 
> As You can see this one return 17 records .. from all indexes.
> 
> So my question is ... is there some kind of limit on has\_child query and  
> aliases ??
> 
> Elasticsearch 1.2.1
> 
> Best ragards,  
> Pawel

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2f2da2e4-923f-4703-a5d9-7a3eca6cea63%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2f2da2e4-923f-4703-a5d9-7a3eca6cea63%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:16am UTC](https://discuss.elastic.co/t/has-child-query-on-an-alias/18599/3 "2017-07-06T01:16:30Z")

</div>


