diff --git a/src/test/java/org/elasticsearch/test/integration/search/sort/SimpleSortTests.java b/src/test/java/org/elasticsearch/test/integration/search/sort/SimpleSortTests.java index d7343620d44e8..1f35ef044df3c 100644 --- a/src/test/java/org/elasticsearch/test/integration/search/sort/SimpleSortTests.java +++ b/src/test/java/org/elasticsearch/test/integration/search/sort/SimpleSortTests.java @@ -33,6 +33,8 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; + import java.io.IOException; import java.util.ArrayList; @@ -790,16 +792,14 @@ public void testIgnoreUnmapped() throws Exception { .field("i_value", -1) .field("d_value", -1.1) .endObject()).execute().actionGet(); - - client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForYellowStatus().execute().actionGet(); - + ensureYellow(); logger.info("--> sort with an unmapped field, verify it fails"); try { - client().prepareSearch() + SearchResponse result = client().prepareSearch() .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("kkk")) .execute().actionGet(); - assert false; + assertThat("Expected exception but returned with", result, nullValue()); } catch (SearchPhaseExecutionException e) { } @@ -808,8 +808,7 @@ public void testIgnoreUnmapped() throws Exception { .setQuery(matchAllQuery()) .addSort(SortBuilders.fieldSort("kkk").ignoreUnmapped(true)) .execute().actionGet(); - - assertThat(searchResponse.getFailedShards(), equalTo(0)); + assertNoFailures(searchResponse); } @Test