File tree 1 file changed +7
-1
lines changed
server/src/internalClusterTest/java/org/opensearch/search/simple
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -432,7 +432,13 @@ 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
+ if (size < 5 ) {
438
+ assertEquals (EQUAL_TO , searchResponse .getHits ().getTotalHits ().relation ());
439
+ } else {
440
+ assertEquals (GREATER_THAN_OR_EQUAL_TO , searchResponse .getHits ().getTotalHits ().relation ());
441
+ }
436
442
}
437
443
438
444
public void testSimpleTerminateAfterTrackTotalHitsUpToRandomSize0 () throws Exception {
You can’t perform that action at this time.
0 commit comments