# Date indexes as yesterday

**URL:** https://discuss.elastic.co/t/date-indexes-as-yesterday/298192
**Category:** Elasticsearch
**Created:** [February 24, 2022, 4:54pm UTC](https://discuss.elastic.co/t/date-indexes-as-yesterday/298192 "2022-02-24T16:54:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![SKraine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skraine/32/99794_2.png) [@SKraine](https://discuss.elastic.co/u/SKraine)
#### Post date: [February 24, 2022, 4:54pm UTC](https://discuss.elastic.co/t/date-indexes-as-yesterday/298192/1 "2022-02-24T16:54:27Z")

</div>

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

```auto
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:

```auto
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

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [February 26, 2022, 1:58am UTC](https://discuss.elastic.co/t/date-indexes-as-yesterday/298192/2 "2022-02-26T01:58:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![SKraine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skraine/32/99794_2.png) [@SKraine](https://discuss.elastic.co/u/SKraine)
#### Post date: [February 28, 2022, 3:16pm UTC](https://discuss.elastic.co/t/date-indexes-as-yesterday/298192/3 "2022-02-28T15:16:10Z")

</div>

that seemed to do the trick, thanks

---

<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: [March 28, 2022, 3:16pm UTC](https://discuss.elastic.co/t/date-indexes-as-yesterday/298192/4 "2022-03-28T15:16:50Z")

</div>

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