# Pre\_zone\_adjust\_large\_interval is not working

**URL:** <https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180>\
**Category:** Elasticsearch\
**Created:** [March 30, 2012, 1:54pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180 "2012-03-30T13:54:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [March 30, 2012, 1:54pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/1 "2012-03-30T13:54:05Z")

</div>

Hi,

I try to use "pre\_zone\_adjust\_large\_interval":true with 'date\_histogram' as  
follows:  
{  
"size":0,  
"facets":{  
"rated\_good":{  
"date\_histogram":{  
"pre\_zone\_adjust\_large\_interval":true,  
"field":"chat.start\_date",  
"interval":"day",  
"pre\_zone":"Europe/Warsaw"  
},  
"facet\_filter":{  
"and":[  
{  
"range":{  
"chat.start\_date":{  
"from":"2012-03-28T23:46:26Z",  
"to":"2012-03-28T23:46:27Z"  
}  
}  
},  
{  
"term":{  
"chat.rate":2  
}  
}  
]  
}  
}  
}  
}

This request will find one document that has chat.start\_date =  
"2012-03-28T23:46:26Z" (in Europe/Warsaw it is "2012-03-29T01:46:26"). The  
datetime in the response should be: "2012-03-28T22:00:00Z" right? (it  
is 2012-03-29T00:00:00Z converted to 2012-03-28T22:00:00Z due  
to pre\_zone\_adjust\_large\_interval set to true and pre\_zone  
"Europe/Warsaw"), but as you can see below it is 1332979200000 which is  
exactly 2012-03-29T00:00:00Z as it is when not  
using pre\_zone\_adjust\_large\_interval. Am I doing something wrong (most  
probably :))?

The result is of the request above is:  
{  
"took" : 11,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1048608,  
"max\_score" : 1.0,  
"hits" : []  
},  
"facets" : {  
"rated\_good" : {  
"\_type" : "date\_histogram",  
"entries" : [ {  
"time" : 1332979200000,  
"count" : 1  
} ]  
}  
}  
}

Thanks for help.  
Best regards  
Marcin.

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [March 30, 2012, 1:55pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/2 "2012-03-30T13:55:07Z")

</div>

I forgot to add that I am using ES 0.19.1 (it behaved the same on ES  
0.19.0.RC3)

2012/3/30 Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)

> Hi,
> 
> I try to use "pre\_zone\_adjust\_large\_interval":true with 'date\_histogram'  
> as follows:  
> {  
> "size":0,  
> "facets":{  
> "rated\_good":{  
> "date\_histogram":{  
> "pre\_zone\_adjust\_large\_interval":true,  
> "field":"chat.start\_date",  
> "interval":"day",  
> "pre\_zone":"Europe/Warsaw"  
> },  
> "facet\_filter":{  
> "and":[  
> {  
> "range":{  
> "chat.start\_date":{  
> "from":"2012-03-28T23:46:26Z",  
> "to":"2012-03-28T23:46:27Z"  
> }  
> }  
> },  
> {  
> "term":{  
> "chat.rate":2  
> }  
> }  
> ]  
> }  
> }  
> }  
> }
> 
> This request will find one document that has chat.start\_date =  
> "2012-03-28T23:46:26Z" (in Europe/Warsaw it is "2012-03-29T01:46:26"). The  
> datetime in the response should be: "2012-03-28T22:00:00Z" right? (it  
> is 2012-03-29T00:00:00Z converted to 2012-03-28T22:00:00Z due  
> to pre\_zone\_adjust\_large\_interval set to true and pre\_zone  
> "Europe/Warsaw"), but as you can see below it is 1332979200000 which is  
> exactly 2012-03-29T00:00:00Z as it is when not  
> using pre\_zone\_adjust\_large\_interval. Am I doing something wrong (most  
> probably :))?
> 
> The result is of the request above is:  
> {  
> "took" : 11,  
> "timed\_out" : false,  
> "\_shards" : {  
> "total" : 5,  
> "successful" : 5,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 1048608,  
> "max\_score" : 1.0,  
> "hits" :   
> },  
> "facets" : {  
> "rated\_good" : {  
> "\_type" : "date\_histogram",  
> "entries" : [ {  
> "time" : 1332979200000,  
> "count" : 1  
> } ]  
> }  
> }  
> }
> 
> Thanks for help.  
> Best regards  
> Marcin.

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [March 30, 2012, 5:21pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/3 "2012-03-30T17:21:20Z")

</div>

Maybe someone could show me working example with pre\_zone\_adjust\_large\_interval  
? 🙂 I could try to work this out by myself then.

Thanks.

W dniu piątek, 30 marca 2012 użytkownik Marcin Dojwa napisał:

> I forgot to add that I am using ES 0.19.1 (it behaved the same on ES  
> 0.19.0.RC3)
> 
> 2012/3/30 Marcin Dojwa \<[m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) \<javascript:\_e({},  
> 'cvml', 'm.dojwa@livechatinc.com');\>\>
> 
> > Hi,
> > 
> > I try to use "pre\_zone\_adjust\_large\_interval":true with 'date\_histogram'  
> > as follows:  
> > {  
> > "size":0,  
> > "facets":{  
> > "rated\_good":{  
> > "date\_histogram":{  
> > "pre\_zone\_adjust\_large\_interval":true,  
> > "field":"chat.start\_date",  
> > "interval":"day",  
> > "pre\_zone":"Europe/Warsaw"  
> > },  
> > "facet\_filter":{  
> > "and":[  
> > {  
> > "range":{  
> > "chat.start\_date":{  
> > "from":"2012-03-28T23:46:26Z",  
> > "to":"2012-03-28T23:46:27Z"  
> > }  
> > }  
> > },  
> > {  
> > "term":{  
> > "chat.rate":2  
> > }  
> > }  
> > ]  
> > }  
> > }  
> > }  
> > }
> > 
> > This request will find one document that has chat.start\_date =  
> > "2012-03-28T23:46:26Z" (in Europe/Warsaw it is "2012-03-29T01:46:26"). The  
> > datetime in the response should be: "2012-03-28T22:00:00Z" right? (it  
> > is 2012-03-29T00:00:00Z converted to 2012-03-28T22:00:00Z due  
> > to pre\_zone\_adjust\_large\_interval set to true and pre\_zone  
> > "Europe/Warsaw"), but as you can see below it is 1332979200000 which is  
> > exactly 2012-03-29T00:00:00Z as it is when not  
> > using pre\_zone\_adjust\_large\_interval. Am I doing something wrong (most  
> > probably :))?
> > 
> > The result is of the request above is:  
> > {  
> > "took" : 11,  
> > "timed\_out" : false,  
> > "\_shards" : {  
> > "total" : 5,  
> > "successful" : 5,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 1048608,  
> > "max\_score" : 1.0,  
> > "hits" :   
> > },  
> > "facets" : {  
> > "rated\_good" : {  
> > "\_type" : "date\_histogram",  
> > "entries" : [ {  
> > "time" : 1332979200000,  
> > "count" : 1  
> > } ]  
> > }  
> > }  
> > }
> > 
> > Thanks for help.  
> > Best regards  
> > Marcin.

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [March 30, 2012, 6:03pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/4 "2012-03-30T18:03:42Z")

</div>

On Mar 30, 10:21 am, Marcin Dojwa [m.do...@livechatinc.com](mailto:m.do...@livechatinc.com) wrote:

> Maybe someone could show me working example with pre\_zone\_adjust\_large\_interval  
> ? 🙂 I could try to work this out by myself then.

I'm also using 0.19.1 and do:

"facets" : {  
"timeline" : {  
"date\_histogram" : {  
"field" : "timestamp",  
"interval" : "day",  
"pre\_zone" : "US/Pacific",  
"pre\_zone\_adjust\_large\_interval" : true  
}  
}  
}

This returns e.g.

"facets" : {  
"timeline" : {  
"\_type" : "date\_histogram",  
"entries" : [ {  
"time" : 1301554800000,  
"count" : 1  
} ]  
}  
}

1301554800000 == 2011-03-31T00:00:00.000-07:00

I don't have a facet\_filter, maybe that is causing the problem?

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [March 31, 2012, 11:54am UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/5 "2012-03-31T11:54:58Z")

</div>

Hi, thanks for response. Unfortunately this is not a problem of facet  
filters. The following gives the same problem:

{  
"size":0,  
"facets":{  
"rated\_good":{  
"date\_histogram":{  
"field":"chat.start\_date",  
"interval":"day",  
"time\_zone":"Europe/Warsaw",  
"pre\_zone\_adjust\_large\_interval":true  
}  
}  
}  
}

A part of response:  
{  
"time" : 1332892800000,  
"count" : 360  
}

1332892800000 -\> 2012-03-28T00:00:00Z

So the response is not right. Maybe there is anything in config file that I  
should change ? (I use the default one).

Best regards.

2012/3/30 Eric Jain [eric.jain@gmail.com](mailto:eric.jain@gmail.com)

> On Mar 30, 10:21 am, Marcin Dojwa [m.do...@livechatinc.com](mailto:m.do...@livechatinc.com) wrote:
> 
> > Maybe someone could show me working example with  
> > pre\_zone\_adjust\_large\_interval  
> > ? 🙂 I could try to work this out by myself then.
> 
> I'm also using 0.19.1 and do:
> 
> "facets" : {  
> "timeline" : {  
> "date\_histogram" : {  
> "field" : "timestamp",  
> "interval" : "day",  
> "pre\_zone" : "US/Pacific",  
> "pre\_zone\_adjust\_large\_interval" : true  
> }  
> }  
> }
> 
> This returns e.g.
> 
> "facets" : {  
> "timeline" : {  
> "\_type" : "date\_histogram",  
> "entries" : [ {  
> "time" : 1301554800000,  
> "count" : 1  
> } ]  
> }  
> }
> 
> 1301554800000 == 2011-03-31T00:00:00.000-07:00
> 
> I don't have a facet\_filter, maybe that is causing the problem?

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [March 31, 2012, 5:42pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/6 "2012-03-31T17:42:50Z")

</div>

On Sat, Mar 31, 2012 at 04:54, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) wrote:

> So the response is not right. Maybe there is anything in config file that I  
> should change ? (I use the default one).

I don't have any special configuration, either.

Here's the unit test I use to verify that preZoneAdjustLargeInterval  
works the way I expect it to:

> <https://gist.github.com/ejain/2267024>

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [March 31, 2012, 6:59pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/7 "2012-03-31T18:59:39Z")

</div>

Hi, thanks, but I can not run this unit test. To be sure that I did not  
missed anything I did a simple example:

1. 

curl -XPUT '[http://localhost:9200/twitter/tweet/1](http://localhost:9200/twitter/tweet/1)' -d '  
{  
"user":"kimchy",  
"post\_date":"2009-11-15T14:12:12Z",  
"message":"trying out Elastic Search"  
}  
'

1. 

curl -X POST "[http://localhost:9200/twitter/tweet/\_search?pretty=true](http://localhost:9200/twitter/tweet/_search?pretty=true)" -d '  
{  
"query":{  
"match\_all":{

```
  }

```

},  
"facets":{  
"histo1":{  
"date\_histogram":{  
"field":"post\_date",  
"interval":"day",  
"pre\_zone":"Europe/Warsaw",  
"pre\_zone\_adjust\_large\_interval":true  
}  
}  
}  
}  
'

The result of 2:  
{  
"took":2,  
"timed\_out":false,  
"\_shards":{  
"total":5,  
"successful":5,  
"failed":0  
},  
"hits":{  
"total":1,  
"max\_score":1.0,  
"hits":[  
{  
"\_index":"twitter",  
"\_type":"tweet",  
"\_id":"1",  
"\_score":1.0,  
"\_source":{  
"user":"kimchy",  
"post\_date":"2009-11-15T14:12:12",  
"message":"trying out Elastic Search"  
}  
}  
]  
},  
"facets":{  
"histo1":{  
"\_type":"date\_histogram",  
"entries":[  
{  
"time":1258243200000,  
"count":1  
}  
]  
}  
}  
}

Time: 1258243200000 \> 2009-11-15T00:00:00 UTC but it should be  
2009-11-14T22:00:00  
UTC (Europe/Warsaw is GMT+2 currently - CEST)

I have no idea what could be wrong 😕 Does anyone know ? 🙂

Thanks for help.  
Best regards.  
Marcin.

2012/3/31 Eric Jain [eric.jain@gmail.com](mailto:eric.jain@gmail.com)

> On Sat, Mar 31, 2012 at 04:54, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)  
> wrote:
> 
> > So the response is not right. Maybe there is anything in config file  
> > that I  
> > should change ? (I use the default one).
> 
> I don't have any special configuration, either.
> 
> Here's the unit test I use to verify that preZoneAdjustLargeInterval  
> works the way I expect it to:
> 
> [Unit test for using elasticsearch's DateHistogramFacet with time zones. · GitHub](https://gist.github.com/2267024)

---

<div class="post-metadata">

**Author:** ![Marcin\_Dojwa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcin_dojwa/32/2307_2.png) [@Marcin\_Dojwa](https://discuss.elastic.co/u/Marcin_Dojwa)\
**Post date:** [April 2, 2012, 2:32pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/8 "2012-04-02T14:32:01Z")

</div>

Unfortunately it looks like it's not working at all here ☹ I did a  
workaround at my end.

Best regards.

2012/3/31 Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)

> Hi, thanks, but I can not run this unit test. To be sure that I did not  
> missed anything I did a simple example:
> 
> 1. 
> 
> curl -XPUT '[http://localhost:9200/twitter/tweet/1](http://localhost:9200/twitter/tweet/1)' -d '  
> {  
> "user":"kimchy",  
> "post\_date":"2009-11-15T14:12:12Z",  
> "message":"trying out Elastic Search"  
> }  
> '
> 
> 1. 
> 
> curl -X POST "[http://localhost:9200/twitter/tweet/\_search?pretty=true](http://localhost:9200/twitter/tweet/_search?pretty=true)" -d  
> '  
> {  
> "query":{  
> "match\_all":{
> 
> ```
> }
> 
> ```
> 
> },  
> "facets":{  
> "histo1":{  
> "date\_histogram":{  
> "field":"post\_date",  
> "interval":"day",  
> "pre\_zone":"Europe/Warsaw",  
> "pre\_zone\_adjust\_large\_interval":true  
> }  
> }  
> }  
> }  
> '
> 
> The result of 2:  
> {  
> "took":2,  
> "timed\_out":false,  
> "\_shards":{  
> "total":5,  
> "successful":5,  
> "failed":0  
> },  
> "hits":{  
> "total":1,  
> "max\_score":1.0,  
> "hits":[  
> {  
> "\_index":"twitter",  
> "\_type":"tweet",  
> "\_id":"1",  
> "\_score":1.0,  
> "\_source":{  
> "user":"kimchy",  
> "post\_date":"2009-11-15T14:12:12",  
> "message":"trying out Elastic Search"  
> }  
> }  
> ]  
> },  
> "facets":{  
> "histo1":{  
> "\_type":"date\_histogram",  
> "entries":[  
> {  
> "time":1258243200000,  
> "count":1  
> }  
> ]  
> }  
> }  
> }
> 
> Time: 1258243200000 \> 2009-11-15T00:00:00 UTC but it should be 2009-11-14T22:00:00  
> UTC (Europe/Warsaw is GMT+2 currently - CEST)
> 
> I have no idea what could be wrong 😕 Does anyone know ? 🙂
> 
> Thanks for help.  
> Best regards.  
> Marcin.
> 
> 2012/3/31 Eric Jain [eric.jain@gmail.com](mailto:eric.jain@gmail.com)
> 
> > On Sat, Mar 31, 2012 at 04:54, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)  
> > wrote:
> > 
> > > So the response is not right. Maybe there is anything in config file  
> > > that I  
> > > should change ? (I use the default one).
> > 
> > I don't have any special configuration, either.
> > 
> > Here's the unit test I use to verify that preZoneAdjustLargeInterval  
> > works the way I expect it to:
> > 
> > [Unit test for using elasticsearch's DateHistogramFacet with time zones. · GitHub](https://gist.github.com/2267024)

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [April 2, 2012, 5:18pm UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/9 "2012-04-02T17:18:17Z")

</div>

On Sat, Mar 31, 2012 at 11:59, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com) wrote:

> Time: 1258243200000 \> 2009-11-15T00:00:00 UTC but it should  
> be 2009-11-14T22:00:00 UTC (Europe/Warsaw is GMT+2 currently - CEST)

I just ran the two curl requests on a fresh install of elasticsearch  
0.19.1, and the facet time that is returned is 1258239600000. So there  
must be another problem?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:33am UTC](https://discuss.elastic.co/t/pre-zone-adjust-large-interval-is-not-working/7180/10 "2017-07-06T03:33:56Z")

</div>


