Date indexes as yesterday

Hey Everyone,
I am trying to index some statistics into my self-hosted elastic stack. I am using the python API to index the document which has a very simple mapping that is dynamically mapped from a dictionary in python. An example is below

data = {
"Date": "01/05/2022"
"data1": 7
"data2": 5
"data3": [1,2,3]
}

I have run this command to set Elastic to look for the same date mapping when indexing:

PUT index1
{
  "mappings": {
    "dynamic_date_formats": ["MM/dd/yyyy"]
  }
}

however, when I index the example document from above, the date field is input as the date previous at 19:00 so it would be:
Jan 4, 2022 @ 19:00:00.000

Is there a way to make sure the date is input correctly?
I am using Elastic V7.16

The problem looks related to timezone.

In Elasticsearch datetime is stored as UTC. And in Kibana it is shown according to the timezone of your browser by default.

I suppose you have to add timezone data when indexing to deal with the problem.

1 Like

that seemed to do the trick, thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.