File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
server/src/internalClusterTest/java/org/opensearch/search/simple Expand file tree Collapse file tree 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
432432 .setTrackTotalHitsUpTo (5 )
433433 .get ();
434434 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+ }
436443 }
437444
438445 public void testSimpleTerminateAfterTrackTotalHitsUpToRandomSize0 () throws Exception {
You can’t perform that action at this time.
0 commit comments