# Problem Parents & Children limit, version 0.19.8

**URL:** <https://discuss.elastic.co/t/problem-parents-children-limit-version-0-19-8/8459>\
**Category:** Elasticsearch\
**Created:** [July 19, 2012, 2:41am UTC](https://discuss.elastic.co/t/problem-parents-children-limit-version-0-19-8/8459 "2012-07-19T02:41:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gustavo\_Maia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_maia/32/2183_2.png) [@Gustavo\_Maia](https://discuss.elastic.co/u/Gustavo_Maia)\
**Post date:** [July 19, 2012, 2:41am UTC](https://discuss.elastic.co/t/problem-parents-children-limit-version-0-19-8/8459/1 "2012-07-19T02:41:48Z")

</div>

hi,

I'm using ES 0.19.8 version.  
I have some problem when use Parents & Children.  
When i have only 10 Children the index and search are OK, function perfect.  
But when i add more 100 children in the same Parent, the same search  
if i done, don't function, don't return any results.

Anybody could help me ?

--  
Gustavo Maia

---

<div class="post-metadata">

**Author:** ![Gustavo\_Maia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_maia/32/2183_2.png) [@Gustavo\_Maia](https://discuss.elastic.co/u/Gustavo_Maia)\
**Post date:** [July 19, 2012, 4:06am UTC](https://discuss.elastic.co/t/problem-parents-children-limit-version-0-19-8/8459/2 "2012-07-19T04:06:22Z")

</div>

Hi,

I had create a gist.

> <https://gist.github.com/gustavobmaia/3140681>

2012/7/18 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):

> hi,
> 
> I'm using ES 0.19.8 version.  
> I have some problem when use Parents & Children.  
> When i have only 10 Children the index and search are OK, function perfect.  
> But when i add more 100 children in the same Parent, the same search  
> if i done, don't function, don't return any results.
> 
> Anybody could help me ?
> 
> --  
> Gustavo Maia

--  
Gustavo Maia

---

<div class="post-metadata">

**Author:** ![Gustavo\_Maia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_maia/32/2183_2.png) [@Gustavo\_Maia](https://discuss.elastic.co/u/Gustavo_Maia)\
**Post date:** [July 19, 2012, 3:33pm UTC](https://discuss.elastic.co/t/problem-parents-children-limit-version-0-19-8/8459/3 "2012-07-19T15:33:49Z")

</div>

I saw the problema,

The problem have when i execute search, if search return more 51  
children have a problem.

See the class TopChildrenQuery.java

2012/7/19 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):

> Hi,
> 
> I had create a gist.
> 
> [Problem Parents & Children limit, version 0.19.8 · GitHub](https://gist.github.com/3140681)
> 
> 2012/7/18 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):
> 
> > hi,
> > 
> > I'm using ES 0.19.8 version.  
> > I have some problem when use Parents & Children.  
> > When i have only 10 Children the index and search are OK, function perfect.  
> > But when i add more 100 children in the same Parent, the same search  
> > if i done, don't function, don't return any results.
> > 
> > Anybody could help me ?
> > 
> > --  
> > Gustavo Maia
> 
> --  
> Gustavo Maia

--  
Gustavo Maia

---

<div class="post-metadata">

**Author:** ![Gustavo\_Maia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_maia/32/2183_2.png) [@Gustavo\_Maia](https://discuss.elastic.co/u/Gustavo_Maia)\
**Post date:** [July 19, 2012, 3:43pm UTC](https://discuss.elastic.co/t/problem-parents-children-limit-version-0-19-8/8459/4 "2012-07-19T15:43:51Z")

</div>

In the class QueryPhase.java  
When i use TopChildrenQuery in the line 153 i can't compare using  
topDocs.totalHits  
if (topDocs.totalHits \<= numDocs) {  
break;  
}

topDocs.totalHits have number os childrem match, need compare number  
os parents return.

Anybody have this problem ?

2012/7/19 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):

> I saw the problema,
> 
> The problem have when i execute search, if search return more 51  
> children have a problem.
> 
> See the class TopChildrenQuery.java
> 
> 2012/7/19 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):
> 
> > Hi,
> > 
> > I had create a gist.
> > 
> > [Problem Parents & Children limit, version 0.19.8 · GitHub](https://gist.github.com/3140681)
> > 
> > 2012/7/18 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):
> > 
> > > hi,
> > > 
> > > I'm using ES 0.19.8 version.  
> > > I have some problem when use Parents & Children.  
> > > When i have only 10 Children the index and search are OK, function perfect.  
> > > But when i add more 100 children in the same Parent, the same search  
> > > if i done, don't function, don't return any results.
> > > 
> > > Anybody could help me ?
> > > 
> > > --  
> > > Gustavo Maia
> > 
> > --  
> > Gustavo Maia
> 
> --  
> Gustavo Maia

--  
Gustavo Maia

---

<div class="post-metadata">

**Author:** ![Gustavo\_Maia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_maia/32/2183_2.png) [@Gustavo\_Maia](https://discuss.elastic.co/u/Gustavo_Maia)\
**Post date:** [July 19, 2012, 4:08pm UTC](https://discuss.elastic.co/t/problem-parents-children-limit-version-0-19-8/8459/5 "2012-07-19T16:08:56Z")

</div>

I opened this issue.

> <https://github.com/elastic/elasticsearch/issues/2106>
>
> I had one small problem when doing a search using TopChildrenQuery and realized …that when I have more than 51 children to the same document, my search has not returned any results. Digging deeper I found comparison what might be wrong in class QueryPhase.
> 
>                                if (topDocs.totalHits \<= numDocs) {
>                                    break;
>                                }
> 
> I changed this comparison for
> 
>                              if (topDocsPhase instanceof TopChildrenQuery) {
>                                if (topDocsPhase.numHits () \<= numDocs) {
>                                  break;
>                                }
>                              else {
>                                if (topDocs.totalHits \<= numDocs) {
>                                    break;
>                                }
>                              }
> 
> But i don't know if is the best solution.
> 
> I posted a code to simulate this problem in gist.
> 
> https://gist.github.com/3140681

2012/7/19 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):

> In the class QueryPhase.java  
> When i use TopChildrenQuery in the line 153 i can't compare using  
> topDocs.totalHits  
> if (topDocs.totalHits \<= numDocs) {  
> break;  
> }
> 
> topDocs.totalHits have number os childrem match, need compare number  
> os parents return.
> 
> Anybody have this problem ?
> 
> 2012/7/19 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):
> 
> > I saw the problema,
> > 
> > The problem have when i execute search, if search return more 51  
> > children have a problem.
> > 
> > See the class TopChildrenQuery.java
> > 
> > 2012/7/19 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):
> > 
> > > Hi,
> > > 
> > > I had create a gist.
> > > 
> > > [Problem Parents & Children limit, version 0.19.8 · GitHub](https://gist.github.com/3140681)
> > > 
> > > 2012/7/18 Gustavo Maia [gustavobbmaia@gmail.com](mailto:gustavobbmaia@gmail.com):
> > > 
> > > > hi,
> > > > 
> > > > I'm using ES 0.19.8 version.  
> > > > I have some problem when use Parents & Children.  
> > > > When i have only 10 Children the index and search are OK, function perfect.  
> > > > But when i add more 100 children in the same Parent, the same search  
> > > > if i done, don't function, don't return any results.
> > > > 
> > > > Anybody could help me ?
> > > > 
> > > > --  
> > > > Gustavo Maia
> > > 
> > > --  
> > > Gustavo Maia
> > 
> > --  
> > Gustavo Maia
> 
> --  
> Gustavo Maia

--  
Gustavo Maia

---

<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:19am UTC](https://discuss.elastic.co/t/problem-parents-children-limit-version-0-19-8/8459/6 "2017-07-06T03:19:48Z")

</div>


