# Mapping fields as date when index already exists

**URL:** <https://discuss.elastic.co/t/mapping-fields-as-date-when-index-already-exists/262745>\
**Category:** Kibana\
**Created:** [January 31, 2021, 9:05am UTC](https://discuss.elastic.co/t/mapping-fields-as-date-when-index-already-exists/262745 "2021-01-31T09:05:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giovanni\_Di\_Lembo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/giovanni_di_lembo/32/45714_2.png) [@Giovanni\_Di\_Lembo](https://discuss.elastic.co/u/Giovanni_Di_Lembo)\
**Post date:** [January 31, 2021, 9:05am UTC](https://discuss.elastic.co/t/mapping-fields-as-date-when-index-already-exists/262745/1 "2021-01-31T09:05:03Z")

</div>

Hi all and sorry for my poor english.  
I've successfully mapped a field as date (for kibana purpose) before ingestioning one document ,using this:

```
PUT my-index
{
  "mappings": {
  "properties": {
  "currentDate": {
  "type": "date" ,
  "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
}
}
}
}

```

I wonder how can I do that when a document is already ingestioned.

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [January 31, 2021, 12:17pm UTC](https://discuss.elastic.co/t/mapping-fields-as-date-when-index-already-exists/262745/2 "2021-01-31T12:17:56Z")

</div>

You can't change a mapping once you have indexed some documents using it. You can only add to the mapping with new fields. But you do have 2 options and the 2nd one is probably the easiest as long as you can ingest that document again easily.

Option 1

1. Create mapping you want
2. [Reindex](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) into new index using new mapping
3. Delete old index
4. Reindex back to original index name

Option 2

1. Delete your current index
2. Reingest your data with new mapping

---

<div class="post-metadata">

**Author:** ![Giovanni\_Di\_Lembo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/giovanni_di_lembo/32/45714_2.png) [@Giovanni\_Di\_Lembo](https://discuss.elastic.co/u/Giovanni_Di_Lembo)\
**Post date:** [February 1, 2021, 8:19am UTC](https://discuss.elastic.co/t/mapping-fields-as-date-when-index-already-exists/262745/3 "2021-02-01T08:19:02Z")

</div>

Why do you not plan to enable a mapping runtime on indexed document (if mapping is compliant )?  
This is could be a good enhancement.

Thanks for your response!

---

<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 1, 2021, 8:19am UTC](https://discuss.elastic.co/t/mapping-fields-as-date-when-index-already-exists/262745/4 "2021-03-01T08:19:03Z")

</div>

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