Add second test case for two fields in range query

In this test one field is a number and the other is a date.

Closes #20447
This commit is contained in:
Nik Everett 2016-09-13 09:26:29 -04:00
parent 444c4f1af8
commit 7888dbfb31
1 changed files with 17 additions and 0 deletions

View File

@ -501,4 +501,21 @@ public class RangeQueryBuilderTests extends AbstractQueryTestCase<RangeQueryBuil
ParsingException e = expectThrows(ParsingException.class, () -> parseQuery(json));
assertEquals("[range] query doesn't support multiple fields, found [age] and [price]", e.getMessage());
}
public void testParseFailsWithMultipleFieldsWhenOneIsDate() throws IOException {
String json =
"{\n" +
" \"range\": {\n" +
" \"age\": {\n" +
" \"gte\": 30,\n" +
" \"lte\": 40\n" +
" },\n" +
" \"" + DATE_FIELD_NAME + "\": {\n" +
" \"gte\": \"2016-09-13 05:01:14\"\n" +
" }\n" +
" }\n" +
" }";
ParsingException e = expectThrows(ParsingException.class, () -> parseQuery(json));
assertEquals("[range] query doesn't support multiple fields, found [age] and [" + DATE_FIELD_NAME + "]", e.getMessage());
}
}