# Convert Float to Geo\_Point

**URL:** https://discuss.elastic.co/t/convert-float-to-geo-point/233743
**Category:** Logstash
**Created:** [May 21, 2020, 1:44pm UTC](https://discuss.elastic.co/t/convert-float-to-geo-point/233743 "2020-05-21T13:44:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jasmin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasmin/32/56586_2.png) [@Jasmin](https://discuss.elastic.co/u/Jasmin)
#### Post date: [May 21, 2020, 1:44pm UTC](https://discuss.elastic.co/t/convert-float-to-geo-point/233743/1 "2020-05-21T13:44:02Z")

</div>

Hi,  
i am trying to convert city name to location and see them in map ,  
my the type of location.lat and location.lon are still float , i can't convert them to geo\_point ,  
my logstash.conf is :  
input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:mysql://localhost:3306/zendb?zeroDateTimeBehavior=convertToNull&serverTimezone=Africa/Tunis"  
jdbc\_user =\> "_**"  
jdbc\_password =\> "**_\*\*"  
jdbc\_driver\_library =\> "/root/mysql-connector-java-8.0.20/mysql-connector-java-8.0.20/mysql-connector-java-8.0.20.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
statement =\> "SELECT e.`id_parent` , sa.`city` , b.`id_address_delivery`, b.`payment`, b.`current_state`,b.`id_order` , b.`id_carrier`,a.`product_id`, b.`date_add`, b.`delivery_date` , d.`na$  
}  
}

filter {  
translate {  
field =\> "city"  
dictionary\_path =\> "/root/codebeautify.yaml"  
fallback =\> "unknown"  
destination=\> "newlocation"  
}  
}  
filter {  
mutate {  
split =\> {"newlocation" =\> ","}  
}  
}

filter {  
mutate {  
add\_field =\> {"latitude" =\> "%{[newlocation][0]}" }  
add\_field =\> {"longitude"=\> "%{[newlocation][1]}" }  
}  
}

filter {  
mutate {  
convert =\> { "longitude" =\> "float" }  
convert =\> { "latitude" =\> "float" }  
}  
}

filter{  
mutate {  
rename =\> {  
"longitude" =\> "[location][lon]"  
"latitude" =\> "[location][lat]"  
}  
}  
}

output {  
elasticsearch {  
"hosts" =\> "localhost:9200"  
"index" =\> "zen"  
manage\_template =\> true  
template =\> "/root/template.json"  
template\_overwrite=\>"true"  
"document\_id" =\> "%{id\_order}"  
}

and my template.json is :  
{  
"index\_patterns": ["zen"],  
"settings": {  
"number\_of\_shards": 5  
},  
"mappings": {  
"properties": {  
"location" : {  
"properties" : {  
"lat" : {  
"type" : "geo\_point"  
},  
"lon" : {  
"type" : "geo\_point"  
}  
}  
}  
}  
}

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 21, 2020, 2:48pm UTC](https://discuss.elastic.co/t/convert-float-to-geo-point/233743/2 "2020-05-21T14:48:01Z")

</div>

> [@Jasmin](#):
>
> and my template.json is

lat and lon cannot independently be of type geo\_point, the combination would have to be a geo\_point.

---

<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: [June 18, 2020, 2:48pm UTC](https://discuss.elastic.co/t/convert-float-to-geo-point/233743/3 "2020-06-18T14:48:11Z")

</div>

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