Top_children query: how to play with factor and incremental_factor knobs?


(benny.sadeh) #1

there's something I just don't get about the Top Children
Queryhttp://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


(adam.porat@gmail.com) #2

Hi,

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

You can find a clarification of TopChildren here.


(system) #3