# How do i reindex data to resolve type conflict?

**URL:** <https://discuss.elastic.co/t/how-do-i-reindex-data-to-resolve-type-conflict/97448>\
**Category:** Elasticsearch\
**Created:** [August 17, 2017, 3:20pm UTC](https://discuss.elastic.co/t/how-do-i-reindex-data-to-resolve-type-conflict/97448 "2017-08-17T15:20:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nfplatzke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nfplatzke/32/20429_2.png) [@nfplatzke](https://discuss.elastic.co/u/nfplatzke)\
**Post date:** [August 17, 2017, 3:20pm UTC](https://discuss.elastic.co/t/how-do-i-reindex-data-to-resolve-type-conflict/97448/1 "2017-08-17T15:20:42Z")

</div>

Can someone provide a full concise example of how I would reindex my data to resolve a conflict? I have two fields where the type changed from string to integer. I don't understand how the reindex process works or why I even need to do it. Is there a full guide that explains how to do this somewhere?

---

<div class="post-metadata">

**Author:** ![nfplatzke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nfplatzke/32/20429_2.png) [@nfplatzke](https://discuss.elastic.co/u/nfplatzke)\
**Post date:** [August 17, 2017, 8:14pm UTC](https://discuss.elastic.co/t/how-do-i-reindex-data-to-resolve-type-conflict/97448/2 "2017-08-17T20:14:04Z")

</div>

After a lot of banging my head on the keyboard I was able to resolve this using these steps:

1. determine the indexes that need to be adjusted: the following python code will filter all indexes containing the fields you specify as well as the differences between the types for each index.

2. download the broken index  
`curl -XGET http://${ELASTICSEARCH_HOST}:9200/${INDEX_NAME}/?pretty > index`  
or if you have an index that already has the correct types set, download that instead as you can use that to create your new indexes instead of manually editing the file

3. edit the downloaded "index" file and remove the 2nd line (the one containing the name of the index) as well as the 2nd to last line (containing the corresponding closing brace). If you had to download a broken index in step 2 because you didn't have one with the correct types, also edit the "index" file to reflect the correct types.

4. upload the new index file  
`curl -XPUT http://${ELASTICSEARCH_HOST}:9200/${INDEX_NAME}-fixed -d@index`  
you can run this step multiple times to fix any indexes of the same type that were output in step 1

5. reindex your data from the old index into the new  
`curl -XPOST http://${ELASTICSEARCH_HOST}:9200/_reindex -d '{ "source": { "index" : "${INDEX_NAME}" },"dest" : { "index" : "${INDEX_NAME}-fixed" } }'`

6. delete the old broken index  
`curl -XDELETE http://${ELASTICSEARCH_HOST}:9200/${INDEX_NAME}`

7. refresh your field list in kibana

---

<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 14, 2017, 8:14pm UTC](https://discuss.elastic.co/t/how-do-i-reindex-data-to-resolve-type-conflict/97448/3 "2017-09-14T20:14:30Z")

</div>

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