# Fixing mappings/index without loasing data

**URL:** https://discuss.elastic.co/t/fixing-mappings-index-without-loasing-data/71218
**Category:** Elasticsearch
**Created:** [January 11, 2017, 1:09pm UTC](https://discuss.elastic.co/t/fixing-mappings-index-without-loasing-data/71218 "2017-01-11T13:09:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Keeper-of-the-Keys](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@Keeper-of-the-Keys](https://discuss.elastic.co/u/Keeper-of-the-Keys)
#### Post date: [January 11, 2017, 1:09pm UTC](https://discuss.elastic.co/t/fixing-mappings-index-without-loasing-data/71218/1 "2017-01-11T13:09:07Z")

</div>

I have a bunch of fields that were interpreted as long/int instead of double/float as result I have the following conflict:  
"cpuload.avg1": "Field [cpuload.avg1] of type [integer] conflicts with existing field of type [float] in other index."

And the fields are neither searchable or aggregatable.

I have tried to fix the mapping, implement dynamic mapping all to no avail I found a doc referring to ES 2.x that claimed I would have to delete the index to be able to remap.

It is my understanding that deleting the index would also mean losing all data aggregated so far, though not a disaster I would like to keep it if possible.  
Is it possible to fix a field mapping without deleting the index?

Technical details: ES 5.0.1 (will probably update to 5.1.1 today/tomorrow), Kibana 5.0.1, Logstash 5.0.1, beats 5.0.2, grafana 4.1.

---

<div class="post-metadata">

### Author: ![abeyad](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@abeyad](https://discuss.elastic.co/u/abeyad)
#### Post date: [January 11, 2017, 5:51pm UTC](https://discuss.elastic.co/t/fixing-mappings-index-without-loasing-data/71218/2 "2017-01-11T17:51:59Z")

</div>

Your best bet is to use the [Reindex APIs](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html). It is helpful for situations like these.

---

<div class="post-metadata">

### Author: ![Keeper-of-the-Keys](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@Keeper-of-the-Keys](https://discuss.elastic.co/u/Keeper-of-the-Keys)
#### Post date: [January 15, 2017, 3:11pm UTC](https://discuss.elastic.co/t/fixing-mappings-index-without-loasing-data/71218/3 "2017-01-15T15:11:50Z")

</div>

I tried using reindex, this did not help because the data is still coming in to the wrong index, it's a date-based index (similar to logstash-2017.01.15), the data gets pushed in by logstash which is parsing the json output from collectl.

I'm thinking I should somehow create a template similar to the metricbeat template and tell logstash to push it every time it creates a new day index...

Any pointers are still very welcome.

---

<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: [February 12, 2017, 3:12pm UTC](https://discuss.elastic.co/t/fixing-mappings-index-without-loasing-data/71218/4 "2017-02-12T15:12:01Z")

</div>

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