# Time zone for simple search

**URL:** <https://discuss.elastic.co/t/time-zone-for-simple-search/7068>\
**Category:** Elasticsearch\
**Created:** [March 20, 2012, 10:58am UTC](https://discuss.elastic.co/t/time-zone-for-simple-search/7068 "2012-03-20T10:58:07Z")\
**Posts on this page:** 5\
**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 20, 2012, 10:58am UTC](https://discuss.elastic.co/t/time-zone-for-simple-search/7068/1 "2012-03-20T10:58:07Z")

</div>

Hi,

Is it possible to use 'pre\_zone' and 'post\_zone' with simple search not  
using date histogram ? For example, I would like to get converted to given  
timezone date in result for:  
{  
"query":{  
"term":{  
"\_all":"help"  
}  
}  
}

Thanks for help.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 20, 2012, 11:02am UTC](https://discuss.elastic.co/t/time-zone-for-simple-search/7068/2 "2012-03-20T11:02:47Z")

</div>

I don't see any date relevant info here in your query. Hits you get back  
will have hte time you indexed it with, and for things like range queries,  
you can specify the time zone in the string representation of the date.

On Tue, Mar 20, 2012 at 12:58 PM, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)wrote:

> Hi,
> 
> Is it possible to use 'pre\_zone' and 'post\_zone' with simple search not  
> using date histogram ? For example, I would like to get converted to given  
> timezone date in result for:  
> {  
> "query":{  
> "term":{  
> "\_all":"help"  
> }  
> }  
> }
> 
> Thanks for help.

---

<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 20, 2012, 12:29pm UTC](https://discuss.elastic.co/t/time-zone-for-simple-search/7068/3 "2012-03-20T12:29:58Z")

</div>

Thanks, I thought that there is a way that Elasticsearch could give me a  
date in returned document converted to the requested timezone. But I can do  
this on my side too so this is not that important. You mentioned about  
specifying time zone in the string representation of date while sending  
range queries, could you give me any example how to specify the timezone  
this way ? Thanks

Best regards.  
Marcin.

2012/3/20 Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)

> I don't see any date relevant info here in your query. Hits you get back  
> will have hte time you indexed it with, and for things like range queries,  
> you can specify the time zone in the string representation of the date.
> 
> On Tue, Mar 20, 2012 at 12:58 PM, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)wrote:
> 
> > Hi,
> > 
> > Is it possible to use 'pre\_zone' and 'post\_zone' with simple search not  
> > using date histogram ? For example, I would like to get converted to given  
> > timezone date in result for:  
> > {  
> > "query":{  
> > "term":{  
> > "\_all":"help"  
> > }  
> > }  
> > }
> > 
> > Thanks for help.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 20, 2012, 8:48pm UTC](https://discuss.elastic.co/t/time-zone-for-simple-search/7068/4 "2012-03-20T20:48:13Z")

</div>

By default, elasticsearch works with the ISO8601 date format (for date  
types): [ISO 8601 - Wikipedia](http://en.wikipedia.org/wiki/ISO_8601).

On Tue, Mar 20, 2012 at 2:29 PM, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)wrote:

> Thanks, I thought that there is a way that Elasticsearch could give me a  
> date in returned document converted to the requested timezone. But I can do  
> this on my side too so this is not that important. You mentioned about  
> specifying time zone in the string representation of date while sending  
> range queries, could you give me any example how to specify the timezone  
> this way ? Thanks
> 
> Best regards.  
> Marcin.
> 
> 2012/3/20 Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com)
> 
> > I don't see any date relevant info here in your query. Hits you get back  
> > will have hte time you indexed it with, and for things like range queries,  
> > you can specify the time zone in the string representation of the date.
> > 
> > On Tue, Mar 20, 2012 at 12:58 PM, Marcin Dojwa [m.dojwa@livechatinc.com](mailto:m.dojwa@livechatinc.com)wrote:
> > 
> > > Hi,
> > > 
> > > Is it possible to use 'pre\_zone' and 'post\_zone' with simple search not  
> > > using date histogram ? For example, I would like to get converted to given  
> > > timezone date in result for:  
> > > {  
> > > "query":{  
> > > "term":{  
> > > "\_all":"help"  
> > > }  
> > > }  
> > > }
> > > 
> > > Thanks for help.

---

<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:35am UTC](https://discuss.elastic.co/t/time-zone-for-simple-search/7068/5 "2017-07-06T03:35:22Z")

</div>


