diff --git a/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java b/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java index 61f2b95d94c..ec4388070b9 100644 --- a/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java +++ b/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java @@ -2456,6 +2456,10 @@ public class SimpleQueryTests extends ElasticsearchIntegrationTest { refresh(); + // Ensure all shards have our mappings, otherwise we can sometimes fail to hit the expected exceptions below, because some shards + // will succeed in running a query (that returns 0 hits) instead of throwing the expected exception: + waitForConcreteMappingsOnAll("test", "type1", "date", "num"); + SearchResponse searchResponse = client().prepareSearch("test") .setQuery(QueryBuilders.rangeQuery("date").from("2014-01-01T00:00:00").to("2014-01-01T00:59:00")) .get();