Skip to content

Commit aef2912

Browse files
committed
fix bug #480
1 parent 593948a commit aef2912

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.nlpcn</groupId>
55
<artifactId>elasticsearch-sql</artifactId>
6-
<version>5.5.0.1</version>
6+
<version>5.5.0.2</version>
77
<packaging>jar</packaging>
88
<description>Query elasticsearch using SQL</description>
99
<name>elasticsearch-sql</name>

src/main/java/org/nlpcn/es4sql/query/maker/AggMaker.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package org.nlpcn.es4sql.query.maker;
22

33
import java.math.BigDecimal;
4+
import java.time.ZoneOffset;
45
import java.util.*;
56

67
import org.elasticsearch.join.aggregations.JoinAggregationBuilders;
78
import org.elasticsearch.script.Script;
8-
import org.elasticsearch.script.ScriptService;
99
import org.elasticsearch.script.ScriptType;
1010
import org.elasticsearch.search.aggregations.AbstractAggregationBuilder;
1111
import org.elasticsearch.search.aggregations.AggregationBuilder;
@@ -417,6 +417,9 @@ private ValuesSourceAggregationBuilder dateRange(MethodField field) {
417417
} else if ("format".equals(kv.key)) {
418418
dateRange.format(value);
419419
continue;
420+
} else if ("time_zone".equals(kv.key)) {
421+
dateRange.timeZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone(ZoneOffset.of(value))));
422+
continue;
420423
} else if ("from".equals(kv.key)) {
421424
dateRange.addUnboundedFrom(kv.value.toString());
422425
continue;
@@ -461,7 +464,7 @@ private DateHistogramAggregationBuilder dateHistogram(MethodField field) throws
461464
dateHistogram.format(value);
462465
break;
463466
case "time_zone":
464-
dateHistogram.timeZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone(value)));
467+
dateHistogram.timeZone(DateTimeZone.forTimeZone(TimeZone.getTimeZone(ZoneOffset.of(value))));
465468
break;
466469
case "min_doc_count":
467470
dateHistogram.minDocCount(Long.parseLong(value));

0 commit comments

Comments
 (0)