diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeFilterParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeFilterParser.java index e115928ee35..1757979e063 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeFilterParser.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/RangeFilterParser.java @@ -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) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermFilterParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermFilterParser.java index 3a225615517..87c2edeba5f 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermFilterParser.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/xcontent/TermFilterParser.java @@ -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"); }