# Change the type from float to geo\_point

**URL:** https://discuss.elastic.co/t/change-the-type-from-float-to-geo-point/67878
**Category:** Elasticsearch
**Created:** [December 2, 2016, 3:48pm UTC](https://discuss.elastic.co/t/change-the-type-from-float-to-geo-point/67878 "2016-12-02T15:48:39Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![xon](https://avatars.discourse-cdn.com/v4/letter/x/838e76/32.png) [@xon](https://discuss.elastic.co/u/xon)
#### Post date: [December 2, 2016, 3:48pm UTC](https://discuss.elastic.co/t/change-the-type-from-float-to-geo-point/67878/1 "2016-12-02T15:48:39Z")

</div>

I did a fresh installation of ES and I noticed that the geo stuff didnt work by default. The old (working) mappings are as follow: (have removed few irrelevant stuff)

> curl '192.168.0.11:9200/filebeat-1/\_mapping?pretty'  
> {  
> "filebeat-1" : {  
> "mappings" : {  
> "apache" : {  
> "\_all" : {  
> "enabled" : true,  
> "norms" : false  
> },  
> "dynamic\_templates" : [  
> {  
> "template1" : {  
> "match" : "\*",  
> "mapping" : {  
> "doc\_values" : true,  
> "ignore\_above" : 1024,  
> "index" : "not\_analyzed",  
> "type" : "{dynamic\_type}"  
> }  
> }  
> }  
> ],  
> "geoip" : {  
> "dynamic" : "true",  
> "properties" : {  
> "city\_name" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> },  
> "continent\_code" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> },  
> "country\_code2" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> "country\_name" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> },  
> "dma\_code" : {  
> "type" : "long"  
> },  
> "ip" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> },  
> "latitude" : {  
> "type" : "float"  
> },  
> **"location" : {**  
> **"type" : "geo\_point"**  
> },  
> "longitude" : {  
> "type" : "float"  
> },  
> "postal\_code" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> },  
> "region\_code" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> },  
> "region\_name" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> },  
> "timezone" : {  
> "type" : "keyword",  
> "ignore\_above" : 1024  
> }  
> }  
> },  
> "geoip" : {  
> "dynamic" : "true",  
> "properties" : {  
> "location" : {  
> "type" : "geo\_point"  
> }  
> }  
> },  
> "message" : {  
> "type" : "text"  
> },  
> "offset" : {  
> "type" : "long"  
> }  
> }  
> }  
> }  
> }  
> }

My fresh new ES mapping looks like:

> ```
> "geoip" : {
> "properties" : {
> "city_name" : {
> "type" : "text",
> "fields" : {
> "keyword" : {
> "type" : "keyword",
> "ignore_above" : 256
> }
> }
> },
> "country_name" : {
> "type" : "text",
> "fields" : {
> "keyword" : {
> "type" : "keyword",
> "ignore_above" : 256
> }
> }
> },
> "dma_code" : {
> "type" : "long"
> },
> "ip" : {
> "type" : "text",
> "fields" : {
> "keyword" : {
> "type" : "keyword",
> "ignore_above" : 256
> }
> }
> },
> "latitude" : {
> "type" : "float"
> },
> **"location" : {**
> **"type" : "float"**
> },
> "longitude" : {
> "type" : "float"
> },
> "postal_code" : {
> "type" : "text",
> "fields" : {
> "keyword" : {
> "type" : "keyword",
> "ignore_above" : 256
> }
> }
> },
> 
> ```

Kibana pinpoints that the geo\_point is not indexed so I assume I have to change the location type to geo\_point in order to make it work ?

How I can import the old mappings to the new instance through curl or something else more convenient or how I can just change the type of that field ? I believe this should be enough to resolve the issue!

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [December 5, 2016, 8:57am UTC](https://discuss.elastic.co/t/change-the-type-from-float-to-geo-point/67878/2 "2016-12-05T08:57:37Z")

</div>

Hey,

you can use the [Get Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/indices-get-mapping.html) and the [Put Mapping API](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/indices-put-mapping.html) to configure mappings. This needs to be done however before data is indexed. So in your case it might make sense to use the [reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-reindex.html) to reindex your data into an index that has the proper mapping applied.

--Alex

---

<div class="post-metadata">

### Author: ![xon](https://avatars.discourse-cdn.com/v4/letter/x/838e76/32.png) [@xon](https://discuss.elastic.co/u/xon)
#### Post date: [December 5, 2016, 9:51am UTC](https://discuss.elastic.co/t/change-the-type-from-float-to-geo-point/67878/3 "2016-12-05T09:51:51Z")

</div>

Hi Alex

Thanks for your response.

I have read this webpage however I want something that it will affect all the indices afterwards. Is it just \* ? Like

> curl -XPUT 'localhost:9200/myindexes\*?pretty' -d'  
> {  
> "mappings": {  
> " **myindexes** \*": {  
> "properties": {  
> "message": {  
> "type": "text"  
> }  
> }  
> }  
> }  
> }'

Is the 'myindexes\*' correct?

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [December 5, 2016, 9:59am UTC](https://discuss.elastic.co/t/change-the-type-from-float-to-geo-point/67878/4 "2016-12-05T09:59:38Z")

</div>

Hey,

again, this needs to be done before data is indexed. You cannot change the type of a field after data has been indexed, because the field defines the way data is written to disk and queried.

--Alex

---

<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: [January 2, 2017, 9:59am UTC](https://discuss.elastic.co/t/change-the-type-from-float-to-geo-point/67878/5 "2017-01-02T09:59:47Z")

</div>

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