Skip to content

Commit

Permalink
Match query should fail when trying to provide several fields in its …
Browse files Browse the repository at this point in the history
…simplified form

fixes elastic#2432
  • Loading branch information
kimchy committed Nov 22, 2012
1 parent 7e2ebe3 commit f6067e6
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -131,7 +131,7 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
} else if ("all".equalsIgnoreCase(zeroTermsDocs)) {
matchQuery.setZeroTermsQuery(MatchQuery.ZeroTermsQuery.ALL);
} else {
throw new QueryParsingException(parseContext.index(), "Unsupported zero_terms_docs value [" + zeroTermsDocs +"]");
throw new QueryParsingException(parseContext.index(), "Unsupported zero_terms_docs value [" + zeroTermsDocs + "]");
}
} else {
throw new QueryParsingException(parseContext.index(), "[match] query does not support [" + currentFieldName + "]");
Expand All @@ -142,7 +142,10 @@ public Query parse(QueryParseContext parseContext) throws IOException, QueryPars
} else {
text = parser.text();
// move to the next token
parser.nextToken();
token = parser.nextToken();
if (token != XContentParser.Token.END_OBJECT) {
throw new QueryParsingException(parseContext.index(), "[match] query parsed in simplified form, with direct field name, but included more options than just the field name, possibly use its 'options' form, with 'query' element?");
}
}

if (text == null) {
Expand Down

0 comments on commit f6067e6

Please sign in to comment.