On 11/12/2012 12:45 AM, simonw wrote:
On Sunday, November 11, 2012 9:59:28 AM UTC+1, P Hill wrote:
On 11/9/2012 5:53 AM, simonw wrote:
On Friday, November 9, 2012 9:48:52 AM UTC+1, Rotem wrote:
So the order of the "should" clauses also have no affect? Are
they all executed or does the first match take without
considering the others? (In case min_should_match is 1) ?
they are all advanced and are considered for scoring in that case.
Maybe my question is not clear. Unlike on the example on the
nested query page I have a nested query imbedded in a bool query
of parent object. The order of processing for the parent objects
is what I'm wondering.
When I set a scope in the nested query, what combination of parent
and nested object queries will have contributed to the resulting
scope? Maybe all of the parent queries, so only then from that
set of parents consider the nested objects and come up with a
result set? I doubt that, because how would two nested queries
both in a must clause be evaluated in their entirity and would
nested objects would be in a scope of the nested objects?
hold on. this thread is about
"When using a should clause of a bool query - what is the order in
which the parts of the should clause are executed? Can I count on them
being executed in the order I provide? (That is - if the 'should'
contains A or B or C, will it be executed in that order?)"
What does it matter the order?
Answer 1: Because the caller wants to declare the query so the most
narrowing selection goes 1st to make things go faster, because the
requester wants to limit the documents under consideration as early as
Answer 2: Because the caller actually wants to view and analyze part of
the results, a "scope" that went into the overall query, because they
think this might have a use, but without a definition of how things are
combined they are not sure. The obvious examples of this is a child or
nested query that happens to be in a bool query.
"they are all advanced and are considered for scoring in that case."
Is not an answer to either motivation to understand the order of
Ok, I'll stay on topic which was "bool query search order".
Now that it has been stated that term queries in shoulds are analyzed to
pick which one is most restricted, what of other queries in the should
list? It seems to me that answering the overall question about should
with a discussion of just picking between term queries is only a start
toward a complete answer. After all there are a couple of dozen other
possibilities that might be in a should clause. Is there some obvious
ranking of such sub-queries?
For example, I probably wouldn't be wanting to do a lot of prefix
queries without first restricting myself to as few docs as possible, via
good term/terms queries. On 1st thought, I'd want phrases and spans
processed after terms. But then maybe someone else has a different case.
What of another bool query that is a "sub experssion" in the shoulds?
How would that enter into any choice and ordering?
And what of "must" and "must not"? Should we expect them to be executed
before/after the shoulds?
What would I do if I wanted them in a different order? The only answer
that seems to be well defined is that filters come after queries, so
true ordering is currently only well defined by putting a query in the
filter of a filtered query.