# Change mapping of field in existing index

**URL:** <https://discuss.elastic.co/t/change-mapping-of-field-in-existing-index/54847>\
**Category:** Elasticsearch\
**Created:** [July 6, 2016, 4:07pm UTC](https://discuss.elastic.co/t/change-mapping-of-field-in-existing-index/54847 "2016-07-06T16:07:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smasell](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/smasell/32/43483_2.png) [@Smasell](https://discuss.elastic.co/u/Smasell)\
**Post date:** [July 6, 2016, 4:07pm UTC](https://discuss.elastic.co/t/change-mapping-of-field-in-existing-index/54847/1 "2016-07-06T16:07:33Z")

</div>

I have my device\_model field, for example like this:

LENOVO IdeaTab A3000-H[graphicsDeviceName: PowerVR SGX 544MP; graphicsDeviceVendor: Imagination Technologies; graphicsDeviceVersion: OpenGL ES 2.0 build 1.9@2204701; graphicsMemorySize: 60; operatingSystem: Android OS 4.2.2 / API-17 (JDQ39/A3000\_A422\_003\_026\_130823\_WW\_SMS\_FUSE); processorCount: 4; processorType: ARMv7 VFPv3 NEON; systemMemorySize: 974; maxTextureSize: 4096]

I want to aggregate to know devices:

"aggs" : {  
"devices" : {  
"terms" : { "field" : "device\_model",  
"size": 0  
}  
}  
}  
But it returns me only one words aggregation like this:

"aggregations": {  
"user-ids": {  
"doc\_count\_error\_upper\_bound": 0,  
"sum\_other\_doc\_count": 0,  
"buckets": [  
{  
"key": "android",  
"doc\_count": 20851  
},  
{  
"key": "api",  
"doc\_count": 20851  
},  
{  
"key": "es",  
"doc\_count": 20851  
},  
But I want to see whole field. What should I do for elasticsearch not divide my string field when I aggregated?

My mapping:  
"warhammer":{  
"mappings": {  
"logs": {  
"properties": {  
"cpu\_avg": {"type": "double"},  
"device\_model": { "type": "string" }  
...

I've tried to change mapping through SENSE:  
PUT /warhammer  
{  
"device\_model": { "type": "string",  
"fields": { "raw":  
{ "type": "string", "index": "not\_analyzed" } } }  
}  
and it gives me:{  
"error": "RemoteTransportException[[[kibana.herocraft.com](http://kibana.herocraft.com)][inet[/192.168.0.1:9300]][indices:admin/create]]; nested: IndexAlreadyExistsException[[warhammer] already exists]; ",  
"status": 400  
}  
what should I do next?

---

<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:** [July 6, 2016, 9:53pm UTC](https://discuss.elastic.co/t/change-mapping-of-field-in-existing-index/54847/2 "2016-07-06T21:53:27Z")

</div>

You need to reindex, you cannot change data that has already been indexed.

---

<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 5, 2017, 10:37pm UTC](https://discuss.elastic.co/t/change-mapping-of-field-in-existing-index/54847/3 "2017-07-05T22:37:32Z")

</div>


