That makes sense and that already happens if you check the createWeight
methods of both ChildrenQuery and ChildrenConstantQuery it creates a short
circuit filter, that encapsulates all matching parent ids in a filter.

This mechanism on top has of shortCircuitFilter has shown to give an even
better performance. I tested this a while back, so now that we global
ordinals for p/c we should re-evaluate this. I'll open a follow-up issue
for this, so we can track it.


On 25 April 2014 15:42, Adrien Grand <notifications@github.com> wrote:

> In src/main/java/org/elasticsearch/index/search/child/ChildrenQuery.java:
>
> > @@ -271,216 +234,56 @@ public Scorer scorer(AtomicReaderContext context, boolean scoreDocsInOrder, bool
> >                  return null;
> >              }
> >
> > -            BytesValues bytesValues = parentChildIndexFieldData.load(context).getBytesValues(parentType);
> > +            // We can't be sure of the fact that liveDocs have been applied, so we apply it here. The "remaining"
> > +            // count down (short circuit) logic will then work as expected.
>
> When the number of matchs is low, what about using the inverted index to
> find the matches instead of filtering thanks to field data? Would it make
> sense?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/elasticsearch/elasticsearch/pull/5846/files#r11987469>
> .
>



-- 
Met vriendelijke groet,

Martijn van Groningen