# Reindexing automatically changed my fieldtype

**URL:** https://discuss.elastic.co/t/reindexing-automatically-changed-my-fieldtype/150741
**Category:** Elasticsearch
**Created:** [October 2, 2018, 5:19pm UTC](https://discuss.elastic.co/t/reindexing-automatically-changed-my-fieldtype/150741 "2018-10-02T17:19:22Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![spdoes](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@spdoes](https://discuss.elastic.co/u/spdoes)
#### Post date: [October 2, 2018, 5:19pm UTC](https://discuss.elastic.co/t/reindexing-automatically-changed-my-fieldtype/150741/1 "2018-10-02T17:19:22Z")

</div>

In my original index I had location field with datatype of geo\_point, after reindexing it, the same field in new index seems to have changed to floar  
When trying to make same query in new index (reindexed from old), I get:

"reason": "failed to find geo\_point field [location]",

old index:  
"location": {  
"type": "geo\_point"  
},

new index:  
"location": {  
"properties": {  
"lat": {  
"type": "float"  
},  
"lon": {  
"type": "float"  
}  
}

When I try to change it (although i know it is ilegal), I get:

```
"type": "illegal_argument_exception",
"reason": "Can't merge a non object mapping [location] with an object mapping [location]"
```

---

<div class="post-metadata">

### Author: ![spdoes](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@spdoes](https://discuss.elastic.co/u/spdoes)
#### Post date: [October 2, 2018, 6:55pm UTC](https://discuss.elastic.co/t/reindexing-automatically-changed-my-fieldtype/150741/2 "2018-10-02T18:55:03Z")

</div>

Having that in mind I am thinking on what options do I have:

1. new reindexing setting that specific field type before

2. ES DLS script inline operation to move it the data from one field to another

3. I wrote a script to move that data to a new field with proper datatype:  
however it would take 14 days to finish it, it's about 20M docs

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [October 3, 2018, 10:21am UTC](https://discuss.elastic.co/t/reindexing-automatically-changed-my-fieldtype/150741/3 "2018-10-03T10:21:41Z")

</div>

Did you apply the same mapping to the new index before starting the reindex? If you don't it uses dynamic mappings.

---

<div class="post-metadata">

### Author: ![spdoes](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@spdoes](https://discuss.elastic.co/u/spdoes)
#### Post date: [October 3, 2018, 3:24pm UTC](https://discuss.elastic.co/t/reindexing-automatically-changed-my-fieldtype/150741/4 "2018-10-03T15:24:55Z")

</div>

I guess that was my error. I though that in reindexing it would automatically apply the mappings of the original index... : (

as for solution Warkolm, what do you think is the best ?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [October 3, 2018, 10:13pm UTC](https://discuss.elastic.co/t/reindexing-automatically-changed-my-fieldtype/150741/5 "2018-10-03T22:13:59Z")

</div>

Just create the index before and make sure the original mappings are used at that time.

---

<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 31, 2018, 10:14pm UTC](https://discuss.elastic.co/t/reindexing-automatically-changed-my-fieldtype/150741/6 "2018-10-31T22:14:06Z")

</div>

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