File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
server/src/internalClusterTest/java/org/opensearch/search/simple Expand file tree Collapse file tree 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
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+ 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+ }
436442 }
437443
438444 public void testSimpleTerminateAfterTrackTotalHitsUpToRandomSize0 () throws Exception {
You can’t perform that action at this time.
0 commit comments