Merge pull request #11607 from cbuescher/feature/query-refactoring-rangequery-fix

Fixing edge case in RangeQueryBuilder when using time zone
This commit is contained in:
Christoph Büscher 2015-06-11 18:24:02 +02:00
commit 2a468fdcd3
1 changed files with 4 additions and 0 deletions

View File

@ -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);
} }