Match query should fail when trying to provide several fields in its simplified form

fixes #2432
This commit is contained in:
Shay Banon 2012-11-22 10:23:48 +01:00
parent 2541847945
commit f4d6d8139d
1 changed files with 5 additions and 2 deletions

View File

@ -133,7 +133,7 @@ public class MatchQueryParser implements QueryParser {
} 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 + "]");
@ -144,7 +144,10 @@ public class MatchQueryParser implements QueryParser {
} 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) {