better exception when a field is missing

This commit is contained in:
kimchy 2010-10-25 16:33:55 +02:00
parent cccefad091
commit 2c65be2aad
2 changed files with 8 additions and 0 deletions

View File

@ -103,6 +103,10 @@ public class RangeFilterParser extends AbstractIndexComponent implements XConten
}
}
if (fieldName == null) {
throw new QueryParsingException(index, "No field specified for range filter");
}
Filter filter = null;
MapperService.SmartNameFieldMappers smartNameFieldMappers = parseContext.smartFieldMappers(fieldName);
if (smartNameFieldMappers != null) {

View File

@ -75,6 +75,10 @@ public class TermFilterParser extends AbstractIndexComponent implements XContent
}
}
if (fieldName == null) {
throw new QueryParsingException(index, "No field specified for term filter");
}
if (value == null) {
throw new QueryParsingException(index, "No value specified for term filter");
}