# Top\_children query: how to play with factor and incremental\_factor knobs?

**URL:** <https://discuss.elastic.co/t/top-children-query-how-to-play-with-factor-and-incremental-factor-knobs/7262>\
**Category:** Elasticsearch\
**Created:** [April 8, 2012, 2:00am UTC](https://discuss.elastic.co/t/top-children-query-how-to-play-with-factor-and-incremental-factor-knobs/7262 "2012-04-08T02:00:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![benny\_sadeh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benny_sadeh/32/2797_2.png) [@benny\_sadeh](https://discuss.elastic.co/u/benny_sadeh)\
**Post date:** [April 8, 2012, 2:00am UTC](https://discuss.elastic.co/t/top-children-query-how-to-play-with-factor-and-incremental-factor-knobs/7262/1 "2012-04-08T02:00:02Z")

</div>

there's something I just don't get about the Top Children  
Query[http://www.elasticsearch.org/guide/reference/query-dsl/top-children-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/top-children-query.html)  
description  
...  
it is said it: runs the child query with an estimated hits size ... If  
there aren’t enough parent docs matching the requested from/size search  
request ...  
how does one control/access the "estimated hit size", and how is this  
realted for a query that doesn't use scrolling (from: size:)?

and then comes the example:

How many hits are asked for in the first child query run is controlled  
using the factorparameter (defaults to 5). For example, when asking for 10  
docs with from 0, then the child query will execute with 50 hits expected.  
If not enough parents are found (in our example, 10), and there are still  
more child docs to query, then the search hits are expanded my multiplying  
by the incremental\_factor (defaults to 2).  
but there is no actual use of from/size in the json example:

{  
"top\_children" : {  
"type": "blog\_tag",  
"query" : {  
"term" : {  
"tag" : "something"  
}  
}  
"score" : "max",  
"factor" : 5,  
"incremental\_factor" : 2  
}  
}

so, is this a mute point if the query is not using from/size, or is it  
unwise to use it without from/size?

also, what about the approach of using the "naked" query first, and based  
on its total hits count, invoke a top\_children query with from: 0, size:  
(naked-hits/factor)?  
does this makes sense at all, or am I totally off to looney-land?

please advise,  
Benny

---

<div class="post-metadata">

**Author:** ![adam\_porat](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@adam\_porat](https://discuss.elastic.co/u/adam_porat)\
**Post date:** [August 14, 2014, 11:31am UTC](https://discuss.elastic.co/t/top-children-query-how-to-play-with-factor-and-incremental-factor-knobs/7262/2 "2014-08-14T11:31:25Z")

</div>

Hi,

The "from" and "size" are parameters of the overall query, not of the TopChildren clause.

You can find a clarification of TopChildren [here](http://adam-porat.blogspot.co.il/2014/08/clarifying-elasticsearch-topchildren.html).

---

<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:08am UTC](https://discuss.elastic.co/t/top-children-query-how-to-play-with-factor-and-incremental-factor-knobs/7262/3 "2017-07-06T01:08:36Z")

</div>


