# Field type change from long to string

**URL:** <https://discuss.elastic.co/t/field-type-change-from-long-to-string/5938>\
**Category:** Elasticsearch\
**Created:** [November 22, 2011, 1:12pm UTC](https://discuss.elastic.co/t/field-type-change-from-long-to-string/5938 "2011-11-22T13:12:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalpana\_pinnaka](https://avatars.discourse-cdn.com/v4/letter/k/ed8c4c/32.png) [@kalpana\_pinnaka](https://discuss.elastic.co/u/kalpana_pinnaka)\
**Post date:** [November 22, 2011, 1:12pm UTC](https://discuss.elastic.co/t/field-type-change-from-long-to-string/5938/1 "2011-11-22T13:12:52Z")

</div>

Hi

curl -X PUT "localhost:9200/suggestions/suggest/\_mapping" -d '{  
"suggest" : {  
"properties" : {  
"key" : {  
"type" : "long"  
}  
}  
}  
}'

created mapping like above.  
i want to change key field data type "long" to "string"  
right now i am creating the mapping again with type:"string"  
without recreation of mapping how can i change type "long" to  
"string"

Thanks in advance

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 22, 2011, 1:43pm UTC](https://discuss.elastic.co/t/field-type-change-from-long-to-string/5938/2 "2011-11-22T13:43:25Z")

</div>

You can't change the type of a field once it has been set, since it  
controls how its indexed.

On Tue, Nov 22, 2011 at 3:12 PM, kalpana pinnaka [saikalpana18@gmail.com](mailto:saikalpana18@gmail.com)wrote:

> Hi
> 
> curl -X PUT "localhost:9200/suggestions/suggest/\_mapping" -d '{  
> "suggest" : {  
> "properties" : {  
> "key" : {  
> "type" : "long"  
> }  
> }  
> }  
> }'
> 
> created mapping like above.  
> i want to change key field data type "long" to "string"  
> right now i am creating the mapping again with type:"string"  
> without recreation of mapping how can i change type "long" to  
> "string"
> 
> Thanks in advance

---

<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 6, 2017, 3:47am UTC](https://discuss.elastic.co/t/field-type-change-from-long-to-string/5938/3 "2017-07-06T03:47:54Z")

</div>


