diff --git a/core/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java b/core/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java index c2ad9983290..6d4715e912c 100644 --- a/core/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java +++ b/core/src/main/java/org/elasticsearch/index/query/CommonTermsQueryBuilder.java @@ -345,6 +345,10 @@ public class CommonTermsQueryBuilder extends AbstractQueryBuilder parseQuery(json)); assertEquals("[common] query doesn't support multiple fields, found [message1] and [message2]", e.getMessage()); + + String shortJson = "{\n" + + " \"common\" : {\n" + + " \"message1\" : \"nelly the elephant not as a cartoon\",\n" + + " \"message2\" : \"nelly the elephant not as a cartoon\"\n" + + " }\n" + + "}"; + e = expectThrows(ParsingException.class, () -> parseQuery(shortJson)); + assertEquals("[common] query doesn't support multiple fields, found [message1] and [message2]", e.getMessage()); } }