# Re-mapping field type from date to text

**URL:** <https://discuss.elastic.co/t/re-mapping-field-type-from-date-to-text/136837>\
**Category:** Elasticsearch\
**Created:** [June 21, 2018, 11:24am UTC](https://discuss.elastic.co/t/re-mapping-field-type-from-date-to-text/136837 "2018-06-21T11:24:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vicpav](https://avatars.discourse-cdn.com/v4/letter/v/9de053/32.png) [@vicpav](https://discuss.elastic.co/u/vicpav)\
**Post date:** [June 21, 2018, 11:24am UTC](https://discuss.elastic.co/t/re-mapping-field-type-from-date-to-text/136837/1 "2018-06-21T11:24:41Z")

</div>

Hi,

Due to the changes in our application logging, one of the JSON fields`level1.level2.level3.version` has changed its format from date-like "2018-05-23" to URL+date format like "[https://CDN.server.com/template#2018-06-21](https://CDN.server.com/template#2018-06-21)". The initial field mapping was auto-generated by Elasticsearch server with type "date" and now it has recognized it as a "text" and marked the field with "conflict" type.

Now, when I do the search in Kibana, one of the shards is reported as having failure and the reason is

> Fielddata is disabled on text fields by default. Set fielddata=true on [level1.level2.level3.version] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.

By checking the index patterns in Kibana for that field, I can see that both `level1.level2.level3.version` and `level1.level2.level3.version.keyword` are created, but both are marked as searchable and aggregatable. I guess that only the keyword field should be aggregatable and that is what the error message is trying to say.

How can I mark the original field to be not aggregatable and re-map the history data into new format?

---

<div class="post-metadata">

**Author:** ![tdasch](https://avatars.discourse-cdn.com/v4/letter/t/58f4c7/32.png) [@tdasch](https://discuss.elastic.co/u/tdasch)\
**Post date:** [June 21, 2018, 11:56am UTC](https://discuss.elastic.co/t/re-mapping-field-type-from-date-to-text/136837/2 "2018-06-21T11:56:43Z")

</div>

Hey Victor,

You are correct, keyword fields are not analyzed and can be used for aggregations and sorting.

I believe you need to setup a new mapping as you can't change the mapping of an existing field. Which means you'll have to reindex as well.

---

<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:** [July 19, 2018, 11:56am UTC](https://discuss.elastic.co/t/re-mapping-field-type-from-date-to-text/136837/3 "2018-07-19T11:56:46Z")

</div>

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