# Converting string to date fields

**URL:** <https://discuss.elastic.co/t/converting-string-to-date-fields/199287>\
**Category:** Elasticsearch\
**Created:** [September 12, 2019, 4:28pm UTC](https://discuss.elastic.co/t/converting-string-to-date-fields/199287 "2019-09-12T16:28:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![moti.mor](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@moti.mor](https://discuss.elastic.co/u/moti.mor)\
**Post date:** [September 12, 2019, 4:28pm UTC](https://discuss.elastic.co/t/converting-string-to-date-fields/199287/1 "2019-09-12T16:28:24Z")

</div>

Hi,  
I have two fields that are tagged as string I want to produce the same fields that will be as a date field. (I have no problem creating new fields from existing fields).

Attached Image. Would appreciate help

many thanks  
 ![Capture1](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f538ec3a427987862d461280b99a3ec82d7edaac.jpeg)

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [September 12, 2019, 8:13pm UTC](https://discuss.elastic.co/t/converting-string-to-date-fields/199287/2 "2019-09-12T20:13:22Z")

</div>

You'll need to reindex that data to convert it to a date. The procedure would be:

1. Create a new index with the correct mappings (`date` for `startStamp` and `stopStamp`)
2. Reindex the data manually, or with the [reindex api](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html)

Elasticsearch doesn't allow modifying mappings of existing fields, so you have to create a new index and re-add the data to make it work.

---

<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:** [October 10, 2019, 8:23pm UTC](https://discuss.elastic.co/t/converting-string-to-date-fields/199287/3 "2019-10-10T20:23:37Z")

</div>

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