[TEST] test that term query throws error when made against multiple fields

This commit is contained in:
javanna 2016-08-03 19:55:31 +02:00 committed by Luca Cavanna
parent 389bd06846
commit 6d228bb09c
1 changed files with 20 additions and 0 deletions

View File

@ -149,4 +149,24 @@ public class TermQueryBuilderTests extends AbstractTermQueryTestCase<TermQueryBu
assertEquals("Geo fields do not support exact searching, use dedicated geo queries instead: [mapped_geo_point]",
e.getMessage());
}
public void testParseFailsWithMultipleFields() throws IOException {
String json = "{\n" +
" \"term\" : {\n" +
" \"message1\" : {\n" +
" \"value\" : \"this\"\n" +
" },\n" +
" \"message2\" : {\n" +
" \"value\" : \"this\"\n" +
" }\n" +
" }\n" +
"}";
try {
parseQuery(json);
fail("parseQuery should have failed");
} catch(ParsingException e) {
assertEquals("[term] query does not support different field names, use [bool] query instead", e.getMessage());
}
}
}