diff --git a/server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java b/server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java index 26f4afaa1dc..c282628b0d0 100644 --- a/server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java +++ b/server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java @@ -93,7 +93,8 @@ class SearchQueryThenFetchAsyncAction extends AbstractSearchAsyncAction InternalAggregationTestCase.emptyReduceContextBuilder()); @@ -150,7 +171,11 @@ public class SearchQueryThenFetchAsyncActionTests extends ESTestCase { assertThat(numWithTopDocs.get(), equalTo(0)); } else { assertTrue(canReturnNullResponse.get()); - assertThat(numWithTopDocs.get(), greaterThanOrEqualTo(1)); + if (withCollapse) { + assertThat(numWithTopDocs.get(), equalTo(0)); + } else { + assertThat(numWithTopDocs.get(), greaterThanOrEqualTo(1)); + } } SearchPhaseController.ReducedQueryPhase phase = action.results.reduce(); assertThat(phase.numReducePhases, greaterThanOrEqualTo(1));