File tree 1 file changed +8
-1
lines changed
server/src/internalClusterTest/java/org/opensearch/search/simple
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -432,7 +432,14 @@ public void doTestSimpleTerminateAfterTrackTotalHitsUpTo(int size) throws Except
432
432
.setTrackTotalHitsUpTo (5 )
433
433
.get ();
434
434
assertEquals (5 , searchResponse .getHits ().getTotalHits ().value ());
435
- assertEquals (GREATER_THAN_OR_EQUAL_TO , searchResponse .getHits ().getTotalHits ().relation ());
435
+ // With approximation on LONG fields, if size < trackTotalHitsUpTo (5), we can efficiently determine the exact count and return
436
+ // EQUAL_TO relation.
437
+ System .out .println ("The size is " + size );
438
+ if (size <= 5 ) {
439
+ assertEquals (EQUAL_TO , searchResponse .getHits ().getTotalHits ().relation ());
440
+ } else {
441
+ assertEquals (GREATER_THAN_OR_EQUAL_TO , searchResponse .getHits ().getTotalHits ().relation ());
442
+ }
436
443
}
437
444
438
445
public void testSimpleTerminateAfterTrackTotalHitsUpToRandomSize0 () throws Exception {
You can’t perform that action at this time.
0 commit comments