# Help reindexing to change date format

**URL:** https://discuss.elastic.co/t/help-reindexing-to-change-date-format/243356
**Category:** Elasticsearch
**Created:** [July 31, 2020, 1:06pm UTC](https://discuss.elastic.co/t/help-reindexing-to-change-date-format/243356 "2020-07-31T13:06:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gius78](https://avatars.discourse-cdn.com/v4/letter/g/7ea924/32.png) [@gius78](https://discuss.elastic.co/u/gius78)
#### Post date: [July 31, 2020, 1:06pm UTC](https://discuss.elastic.co/t/help-reindexing-to-change-date-format/243356/1 "2020-07-31T13:06:32Z")

</div>

Hi all,  
I have to change the timestamp format of documents in my index.

Currently I have a "yyyymmddhhmmssZ" format.  
I have to change it to something that grafana can understand. So I think Epoch\_millis or ISO.  
can you please help me with a correct console command to do that (if possible)?  
I've tried to create an empty index with the "timestamp" already mapped with an epoch millis format. Then reindexing the whole index, but I obtained the error:

```
 ` "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "failed to parse date field [20140415152752Z] with format [epoch_millis]",
      "caused_by" : {
        "type" : "date_time_parse_exception",
        "reason" : "Failed to parse with all enclosed parsers"
      }`
```

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [August 3, 2020, 9:40am UTC](https://discuss.elastic.co/t/help-reindexing-to-change-date-format/243356/2 "2020-08-03T09:40:26Z")

</div>

Hey,

can you explain, how your reindexing strategy looks like? Where and how are you doing the date conversion? Can you share that snippet?

Thanks!

--Alex

---

<div class="post-metadata">

### Author: ![gius78](https://avatars.discourse-cdn.com/v4/letter/g/7ea924/32.png) [@gius78](https://discuss.elastic.co/u/gius78)
#### Post date: [August 4, 2020, 1:57pm UTC](https://discuss.elastic.co/t/help-reindexing-to-change-date-format/243356/3 "2020-08-04T13:57:04Z")

</div>

Hey,  
I just tried to reindex, without any particular option, from my source index to a destination empty index but with a pre configured mapping with the timestamp field mapped in the way I wanted to, I just hoped the conversion would have happened automatically. I was wrong.  
Anyway I have now discovered that my environment works if I put a T in the yyyymmddhhmmssZ -\> yyyymmddThhmmssZ so I have changed it with a query.  
I had to do that for Grafana, who did not like the yyyymmddhhmmssZ format.

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [August 4, 2020, 2:01pm UTC](https://discuss.elastic.co/t/help-reindexing-to-change-date-format/243356/4 "2020-08-04T14:01:04Z")

</div>

Mappings do not transform the JSON source, just determines how the data is parsed and indexed. If you want to change the format you probably need to reindex using an ingest pipeline.

---

<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: [September 1, 2020, 2:01pm UTC](https://discuss.elastic.co/t/help-reindexing-to-change-date-format/243356/5 "2020-09-01T14:01:11Z")

</div>

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