# Change the default mapping

**URL:** <https://discuss.elastic.co/t/change-the-default-mapping/36701>\
**Category:** Elasticsearch\
**Created:** [December 9, 2015, 7:48am UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701 "2015-12-09T07:48:27Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![krishsan2k](https://avatars.discourse-cdn.com/v4/letter/k/3bc359/32.png) [@krishsan2k](https://discuss.elastic.co/u/krishsan2k)\
**Post date:** [December 9, 2015, 7:48am UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/1 "2015-12-09T07:48:27Z")

</div>

Hi,

my current mapping looks like this,

{  
"threatfeedsone" : {  
"mappings" : {  
"IPv4" : {  
"properties" : {  
"@timestamp" : {  
"type" : "date",  
"format" : "strict\_date\_optional\_time||epoch\_millis"  
},  
"@version" : {  
"type" : "string"  
},  
"direction" : {  
"type" : "string"  
},  
"entity" : {  
"type" : "string"  
},  
"geoip" : {  
"properties" : {  
"area\_code" : {  
"type" : "long"  
},  
"city\_name" : {  
"type" : "string"  
},  
"continent\_code" : {  
"type" : "string"  
},  
"country\_code2" : {  
"type" : "string"  
},  
"country\_code3" : {  
"type" : "string"  
},  
"country\_name" : {  
"type" : "string"  
},  
"dma\_code" : {  
"type" : "long"  
},  
"ip" : {  
"type" : "string"  
},  
"latitude" : {  
"type" : "double"  
},  
"location" : {  
"type" : "double"  
},  
"longitude" : {  
"type" : "double"  
},  
"postal\_code" : {  
"type" : "string"  
},  
"real\_region\_name" : {  
"type" : "string"  
},  
"region\_name" : {  
"type" : "string"  
},  
"timezone" : {  
"type" : "string"  
}  
}  
},  
"host" : {  
"type" : "string"  
},  
"message" : {  
"type" : "string"  
},  
"path" : {  
"type" : "string"  
},  
"source" : {  
"type" : "string"  
},  
"type" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

Please let me know how to change the geo location to geo\_point instead of double

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 9, 2015, 6:43pm UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/2 "2015-12-09T18:43:29Z")

</div>

First of all, you'll have to create a new index with the updated mappings and reindex your data there.

Take these mappings, edit them as necessary, and pass them as the settings of the new index when using the [index creation API call](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.htmlhttps://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html) or issue a subsequent [mapping put call](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html). Finally reindex your data into the new index.

---

<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:** [December 10, 2015, 1:14am UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/3 "2015-12-10T01:14:33Z")

</div>

I'd change a fair bit in that mapping, why do you have postcode as a string for eg, shouldn't that be a number?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 10, 2015, 6:41am UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/4 "2015-12-10T06:41:06Z")

</div>

> I'd change a fair bit in that mapping, why do you have postcode as a string for eg, shouldn't that be a number?

Perhaps, but the postcode of many countries (e.g. [UK](https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom) and [Sweden](https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdomhttps://en.wikipedia.org/wiki/Postal_codes_in_Sweden)) include letters and/or spaces.

---

<div class="post-metadata">

**Author:** ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)\
**Post date:** [December 10, 2015, 10:54am UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/5 "2015-12-10T10:54:50Z")

</div>

> [@magnusbaeck](#):
>
> but the postcode of many countries (e.g. UK and Sweden) include letters and/or spaces

Or worse as that usually fails silently as in the local post office later has to resolve the address manually: Leading zeros (e.g. Germany).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [December 10, 2015, 11:11am UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/6 "2015-12-10T11:11:33Z")

</div>

Yes, it's not that simple, there are postcodes composed of components, like routing key and unique ID and checksum, like the Eircode in Ireland 😄

> **[Eircode:
What’s in a postcode? – Data-Source – Medium](https://medium.com/@beyourownreason/eircode-what-s-in-a-postcode-4df06285391#.tfrd0hetk)**
>
> Much was made of the political wrangling, the failed procurement process or the amount of time it took for Ireland to finally get a…

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 10, 2015, 5:42pm UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/7 "2015-12-10T17:42:30Z")

</div>

Leading zeros in the US as well

---

<div class="post-metadata">

**Author:** ![mainec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mainec/32/5557_2.png) [@mainec](https://discuss.elastic.co/u/mainec)\
**Post date:** [December 10, 2015, 7:41pm UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/8 "2015-12-10T19:41:55Z")

</div>

> [@Ivan](#):
>
> Leading zeros in the US as well

That is weird: I once got a package from a US based company that was missing the leading zero in my postal code. As a result I thought the US don't have this issue - but if it's the same there, I'm wondering who implemented the form I filled in back then. 😉

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 10, 2015, 9:08pm UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/9 "2015-12-10T21:08:25Z")

</div>

The US has its fair share of bad web developers. Are there none were you  
are? I must move there at once! 🙂

Ivan

---

<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:** [December 11, 2015, 2:13am UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/10 "2015-12-11T02:13:18Z")

</div>

> [@magnusbaeck](#):
>
> Perhaps, but the postcode of many countries (e.g. UK and Sweden) include letters and/or spaces.

Oh! Move to AU, we don't have that issue 😉

---

<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, 11:31pm UTC](https://discuss.elastic.co/t/change-the-default-mapping/36701/11 "2017-07-05T23:31:56Z")

</div>


