diff --git a/src/test/java/org/elasticsearch/count/query/SimpleQueryTests.java b/src/test/java/org/elasticsearch/count/query/SimpleQueryTests.java index 72145452087..dafaac22be0 100644 --- a/src/test/java/org/elasticsearch/count/query/SimpleQueryTests.java +++ b/src/test/java/org/elasticsearch/count/query/SimpleQueryTests.java @@ -178,10 +178,15 @@ public class SimpleQueryTests extends ElasticsearchIntegrationTest { assertHitCount(countResponse, 0l); } - @Test + @Test //https://github.com/elasticsearch/elasticsearch/issues/3540 public void testDateRangeInQueryString() { - createIndex("test"); + //the mapping needs to be provided upfront otherwise we are not sure how many failures we get back + //as with dynamic mappings some shards might be lacking behind and parse a different query + assertAcked(prepareCreate("test").addMapping( + "type", "past", "type=date", "future", "type=date" + )); ensureGreen(); + NumShards test = getNumShards("test"); String aMonthAgo = ISODateTimeFormat.yearMonthDay().print(new DateTime(DateTimeZone.UTC).minusMonths(1)); diff --git a/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java b/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java index d664cf9118a..69aee54f98e 100644 --- a/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java +++ b/src/test/java/org/elasticsearch/search/query/SimpleQueryTests.java @@ -428,9 +428,13 @@ public class SimpleQueryTests extends ElasticsearchIntegrationTest { assertHitCount(searchResponse, 0l); } - @Test + @Test //https://github.com/elasticsearch/elasticsearch/issues/3540 public void testDateRangeInQueryString() { - createIndex("test"); + //the mapping needs to be provided upfront otherwise we are not sure how many failures we get back + //as with dynamic mappings some shards might be lacking behind and parse a different query + assertAcked(prepareCreate("test").addMapping( + "type", "past", "type=date", "future", "type=date" + )); ensureGreen(); String aMonthAgo = ISODateTimeFormat.yearMonthDay().print(new DateTime(DateTimeZone.UTC).minusMonths(1));