diff --git a/src/main/java/org/elasticsearch/index/query/RangeFilterParser.java b/src/main/java/org/elasticsearch/index/query/RangeFilterParser.java index f35cb3194a6..94ea2baafe8 100644 --- a/src/main/java/org/elasticsearch/index/query/RangeFilterParser.java +++ b/src/main/java/org/elasticsearch/index/query/RangeFilterParser.java @@ -118,7 +118,7 @@ public class RangeFilterParser implements FilterParser { if (smartNameFieldMappers != null) { if (smartNameFieldMappers.hasMapper()) { //LUCENE 4 UPGRADE range filter should use bytesref too? - filter = smartNameFieldMappers.mapper().rangeFilter(from.utf8ToString(), to.utf8ToString(), includeLower, includeUpper, parseContext); + filter = smartNameFieldMappers.mapper().rangeFilter(from != null ? from.utf8ToString() : null, to != null ? to.utf8ToString() : null, includeLower, includeUpper, parseContext); } } if (filter == null) { diff --git a/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java b/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java index 5cbaccf9db4..780e50fb973 100644 --- a/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java +++ b/src/main/java/org/elasticsearch/index/query/RangeQueryParser.java @@ -110,7 +110,7 @@ public class RangeQueryParser implements QueryParser { if (smartNameFieldMappers != null) { if (smartNameFieldMappers.hasMapper()) { //LUCENE 4 UPGRADE Mapper#rangeQuery should use bytesref as well? - query = smartNameFieldMappers.mapper().rangeQuery(from.utf8ToString(), to.utf8ToString(), includeLower, includeUpper, parseContext); + query = smartNameFieldMappers.mapper().rangeQuery(from != null ? from.utf8ToString() : null, to != null ? to.utf8ToString() : null, includeLower, includeUpper, parseContext); } } if (query == null) {