Fixing edge case in RangeQueryBuilder when using time zone
When specifying a time zone, RangeQueryBuilder currently throws an exeption when the field does not use DateFieldMapper, but if there are no mappers at all for that field it doesn't complain. To be consistent we also throw expection now.
This commit is contained in:
parent
bd2e1632de
commit
78eaffb646
|
@ -304,6 +304,10 @@ public class RangeQueryBuilder extends MultiTermQueryBuilder<RangeQueryBuilder>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query == null) {
|
if (query == null) {
|
||||||
|
if (this.timeZone != null) {
|
||||||
|
throw new QueryParsingException(parseContext, "[range] time_zone can not be applied to non date field ["
|
||||||
|
+ fieldName + "]");
|
||||||
|
}
|
||||||
query = new TermRangeQuery(this.fieldName, BytesRefs.toBytesRef(from), BytesRefs.toBytesRef(to), includeLower, includeUpper);
|
query = new TermRangeQuery(this.fieldName, BytesRefs.toBytesRef(from), BytesRefs.toBytesRef(to), includeLower, includeUpper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue