From bbf40ca0cf56b8475d526dac44e729e9eaf38a38 Mon Sep 17 00:00:00 2001 From: javanna Date: Tue, 9 Aug 2016 09:50:12 +0200 Subject: [PATCH] [TEST] test that term query short syntax throws error when multiple fields are provided --- .../elasticsearch/index/query/TermQueryBuilderTests.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/test/java/org/elasticsearch/index/query/TermQueryBuilderTests.java b/core/src/test/java/org/elasticsearch/index/query/TermQueryBuilderTests.java index 276768183b0..14e5054c5e1 100644 --- a/core/src/test/java/org/elasticsearch/index/query/TermQueryBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/TermQueryBuilderTests.java @@ -155,5 +155,14 @@ public class TermQueryBuilderTests extends AbstractTermQueryTestCase parseQuery(json)); assertEquals("[term] query does not support different field names, use [bool] query instead", e.getMessage()); + + String shortJson = "{\n" + + " \"term\" : {\n" + + " \"message1\" : \"this\",\n" + + " \"message2\" : \"this\"\n" + + " }\n" + + "}"; + e = expectThrows(ParsingException.class, () -> parseQuery(shortJson)); + assertEquals("[term] query does not support different field names, use [bool] query instead", e.getMessage()); } }