File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
server/src/test/java/org/elasticsearch/search/query Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -568,12 +568,13 @@ public void testTerminateAfterWithHitsNoHitCountShortcut() throws Exception {
568568 // size is lower than terminate_after
569569 context .setSize (5 );
570570 // track_total_hits is lower than terminate_after
571- context .trackTotalHitsUpTo (randomIntBetween (1 , 6 ));
571+ int trackTotalHits = randomIntBetween (1 , 6 );
572+ context .trackTotalHitsUpTo (trackTotalHits );
572573 QueryPhase .executeQuery (context );
573574 // depending on docs distribution we may or may not be able to honor terminate_after: low scoring hits are skipped via
574575 // setMinCompetitiveScore, which bypasses terminate_after until the next leaf collector is pulled, when that happens.
575576 assertThat (context .queryResult ().terminatedEarly (), either (is (true )).or (is (false )));
576- assertThat (context .queryResult ().topDocs ().topDocs .totalHits .value (), equalTo ( 7L ));
577+ assertThat (context .queryResult ().topDocs ().topDocs .totalHits .value (), greaterThanOrEqualTo (( long ) trackTotalHits ));
577578 assertThat (context .queryResult ().topDocs ().topDocs .totalHits .relation (), equalTo (TotalHits .Relation .GREATER_THAN_OR_EQUAL_TO ));
578579 assertThat (context .queryResult ().topDocs ().topDocs .scoreDocs .length , equalTo (5 ));
579580 }
You can’t perform that action at this time.
0 commit comments