# Location dosen't convert to geo\_point

**URL:** https://discuss.elastic.co/t/location-dosent-convert-to-geo-point/131199
**Category:** Logstash
**Created:** [May 9, 2018, 3:58pm UTC](https://discuss.elastic.co/t/location-dosent-convert-to-geo-point/131199 "2018-05-09T15:58:56Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)
#### Post date: [May 9, 2018, 3:58pm UTC](https://discuss.elastic.co/t/location-dosent-convert-to-geo-point/131199/1 "2018-05-09T15:58:56Z")

</div>

as descriped [here](https://www.youtube.com/watch?v=mPHvJBJcC5M&index=1&list=LLMx0bPm1vFEgjNZOB94aB5Q&t=311s) i ran this template :

```
  put _template/nyc 
 {
    "order":0,
   "index_patterns":"nyc",
  "mapping":{
   "_default":{
    "properties":{
    "location ":{
      "type":"geo_point"
    }
  }
   }
}
 }

```

then i ran my configuration file :

```
 input{
file{
	path=>"C:\Users\Ahmed\Desktop\311_Service_Requests_from_2015.csv"
            start_position=>"beginning"
             sincedb_path=>NUL
         }
 }
filter{
    csv{
          separator=>","
          columns=>["Unique Key","Created Date","Closed Date","Agency","Agency Name","Complaint Type","Descriptor","Location Type","Incident Zip","Incident Address","Street Name","Cross Street 1","Cross Street 2","Intersection Street 1","Intersection Street 2","Address Type","City","Landmark","Facility Type","Status","Due Date","	Resolution Description","Resolution Action Updated Date","Community Board","Borough","X Coordinate (State Plane)","Y Coordinate (State Plane)","Park Facility Name","Park Borough","School Name","School Number","School Region","School Code","School Phone Number",	"School Address","School City","School State","School Zip","School Not Found","School or Citywide Complaint","Vehicle Type","Taxi Company Borough","Taxi Pick Up Location","Bridge Highway Name","Bridge Highway Direction","Road Ramp","Bridge Highway Segment","Garage Lot Name","Ferry Direction","Ferry Terminal Name","Latitude","Longitude","Location"]

       }
     mutate{
     convert=>["Latitude","float"]
	 convert=>["Longitude","float"]	
	 
 	 }	    
 	 mutate{
 	 rename=>["Latitude","location[lat]"]
 	 rename=>["Longitude","location[lon]"]
 	 }
    

    date{ 
    	match=>["Created Date","MM/dd/yyyy HH:mm:ss aa"]
    	target=>"Date"
    	
    	}
  }

 output{	
    elasticsearch {
     hosts=> "localhost"
     index=> "nyc"
     document_type=>"calls"
    }        
  stdout{codec=>rubydebug}
} 

```

but i only get in the end location.lon and location.lan as float fields and not a geo\_point location field as expecting.  
so what im doing wrong ?

---

<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 9, 2018, 4:39pm UTC](https://discuss.elastic.co/t/location-dosent-convert-to-geo-point/131199/2 "2018-05-09T16:39:53Z")

</div>

> [@akml\_kk](#):
>
> so what im doing wrong ?

I do not know. However, it works if you use a dynamic template.

```
PUT _template/nyc 
{
  "order":0,
  "index_patterns":"nyc",
  "mappings": {
   "calls": {
      "dynamic_templates": [
        {
          "locations": {
            "match": "location",
            "mapping": { "type": "geo_point" }
          }
        }
      ]
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![akml\_kk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akml_kk/32/31069_2.png) [@akml\_kk](https://discuss.elastic.co/u/akml_kk)
#### Post date: [May 9, 2018, 4:57pm UTC](https://discuss.elastic.co/t/location-dosent-convert-to-geo-point/131199/3 "2018-05-09T16:57:48Z")

</div>

Thank you so much Badger, i was struggling with this for two days .

---

<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 9, 2018, 8:55pm UTC](https://discuss.elastic.co/t/location-dosent-convert-to-geo-point/131199/4 "2018-05-09T20:55:08Z")

</div>

> [@akml\_kk](#):
>
> put \_template/nyc  
> {  
> "order":0,  
> "index\_patterns":"nyc",  
> "mapping":{  
> "\_default":{  
> "properties":{  
> "location ":{  
> "type":"geo\_point"  
> }  
> }  
> }  
> }  
> }

In case someone else lands upon this. If you do "GET \_template/nyc" after putting that, you will find the template has no mappings. Three changes are required. "mapping" should be "mappings" and (as Magnus pointed out in the other thread) "location " needs that space to be removed. "\_default" should be "\_default\_".

This works.

```auto
PUT _template/nyc 
 {
    "order":0,
    "index_patterns":"nyc",
    "mappings":{
      "_default_":{
        "properties":{
          "location":{
            "type":"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 6, 2018, 8:55pm UTC](https://discuss.elastic.co/t/location-dosent-convert-to-geo-point/131199/5 "2018-06-06T20:55:13Z")

</div>

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