@@ -592,11 +592,10 @@ public void testOverlappingRanges() throws IOException {
592592 /**
593593 * If the top level query is a runtime field we use the standard aggregator
594594 * because it's marginally faster. You'd expect it to be a *ton* faster but
595- * usually the ranges drive the iteration and they are still fairly fast.
595+ * usually the ranges drive the iteration, and they are still fairly fast.
596596 * But the union operation overhead that comes with combining the range with
597597 * the top level query tends to slow us down more than the standard aggregator.
598598 */
599- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/128471" )
600599 public void testRuntimeFieldTopLevelQueryNotOptimized () throws IOException {
601600 long totalDocs = (long ) RangeAggregator .DOCS_PER_RANGE_TO_USE_FILTERS * 4 ;
602601 SearchLookup lookup = new SearchLookup (s -> null , (ft , l , ftd ) -> null , (ctx , doc ) -> null );
@@ -609,7 +608,8 @@ public void execute() {
609608 Query query = new StringScriptFieldTermQuery (new Script ("dummy" ), scriptFactory , "dummy" , "cat" , false );
610609 debugTestCase (new RangeAggregationBuilder ("r" ).field (NUMBER_FIELD_NAME ).addRange (0 , 1 ).addRange (1 , 2 ).addRange (2 , 3 ), query , iw -> {
611610 for (int d = 0 ; d < totalDocs ; d ++) {
612- iw .addDocument (List .of (new IntPoint (NUMBER_FIELD_NAME , 0 ), new SortedNumericDocValuesField (NUMBER_FIELD_NAME , 0 )));
611+ int v = d % 2 ;
612+ iw .addDocument (List .of (new IntPoint (NUMBER_FIELD_NAME , v ), new SortedNumericDocValuesField (NUMBER_FIELD_NAME , v )));
613613 }
614614 }, (InternalRange <?, ?> r , Class <? extends Aggregator > impl , Map <String , Map <String , Object >> debug ) -> {
615615 assertThat (
@@ -620,7 +620,7 @@ public void execute() {
620620 assertThat (r .getBuckets ().stream ().map (InternalRange .Bucket ::getTo ).collect (toList ()), equalTo (List .of (1.0 , 2.0 , 3.0 )));
621621 assertThat (
622622 r .getBuckets ().stream ().map (InternalRange .Bucket ::getDocCount ).collect (toList ()),
623- equalTo (List .of (totalDocs , 0L , 0L ))
623+ equalTo (List .of (totalDocs / 2 , totalDocs / 2 , 0L ))
624624 );
625625 assertThat (impl , equalTo (RangeAggregator .NoOverlap .class ));
626626 assertMap (
0 commit comments