# Document Date changes after being indexed into Elasticsearch

**URL:** https://discuss.elastic.co/t/document-date-changes-after-being-indexed-into-elasticsearch/162770
**Category:** Elasticsearch
**Created:** [January 3, 2019, 9:01am UTC](https://discuss.elastic.co/t/document-date-changes-after-being-indexed-into-elasticsearch/162770 "2019-01-03T09:01:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ong/32/40766_2.png) [@Ong](https://discuss.elastic.co/u/Ong)
#### Post date: [January 3, 2019, 9:01am UTC](https://discuss.elastic.co/t/document-date-changes-after-being-indexed-into-elasticsearch/162770/1 "2019-01-03T09:01:31Z")

</div>

, I have a database and an Elasticsearch setup. Documents are written to the database first  
and are then indexed into ES. I noticed that the date field in ES is different from that in  
the database.

The date field in ES is incorrect because the documents are dated in the future e.g. 2020 or Dec 2019.

The date field mapping has a date type and epoch format.

The Elasticsearch setup is running on Windows 2016 and the database runs on Windows 2012.

What are the possible causes of this difference?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 3, 2019, 9:16am UTC](https://discuss.elastic.co/t/document-date-changes-after-being-indexed-into-elasticsearch/162770/2 "2019-01-03T09:16:41Z")

</div>

Can you share a document which is wrong and the mapping?

---

<div class="post-metadata">

### Author: ![Ong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ong/32/40766_2.png) [@Ong](https://discuss.elastic.co/u/Ong)
#### Post date: [January 3, 2019, 10:13am UTC](https://discuss.elastic.co/t/document-date-changes-after-being-indexed-into-elasticsearch/162770/3 "2019-01-03T10:13:42Z")

</div>

The mapping for the date field is:

```
 "properties": {
 "DOCUMENTDATE_N_S": {
      "type": "date",
      "format": "epoch_second"
    },
  ...
 }

```

For the document, an example would be the correct date is 13/12/2018 but when searching for the document in kibana, the DOCUMENTDATE\_N\_S field will be 1591027200 which translates to 02 June 2020.

I have made sure that the DB and Elasticsearch servers are both in the same region (United States). The DB is on Windows 2012 while the ES server is on Windows 2016.

What could be the problem causing the date change?

---

<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: [January 31, 2019, 10:13am UTC](https://discuss.elastic.co/t/document-date-changes-after-being-indexed-into-elasticsearch/162770/4 "2019-01-31T10:13:45Z")

</div>

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