mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
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:
parent
444c4f1af8
commit
7888dbfb31
@ -501,4 +501,21 @@ public class RangeQueryBuilderTests extends AbstractQueryTestCase<RangeQueryBuil
|
|||||||
ParsingException e = expectThrows(ParsingException.class, () -> parseQuery(json));
|
ParsingException e = expectThrows(ParsingException.class, () -> parseQuery(json));
|
||||||
assertEquals("[range] query doesn't support multiple fields, found [age] and [price]", e.getMessage());
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user