Timezone of now in elasticsearch

elasticsearchtimezone

What is the timezone of elasticsearch when I use now ?

{
   "range": {
      "myDateInSomeTimezone": {
         "gt": "now"
      }
   }
},

I am wondering what is the timezone of now:

  • is with my server local timezone?
  • is with same timezone of the field?
  • is with UTC timezone?

Best Answer

now is always resolved to unix timestamp in millisecond. So one would need to either store the dates in UTC or speicify the timezone parameter in the range query.

From the documentation :

Dates can be converted from another timezone to UTC either by specifying the time zone in the date value itself (if the format accepts it), or it can be specified as the time_zone parameter:

now is not affected by the time_zone parameter (dates must be stored as UTC).