# Template Creation for type geo\_point in logstash

**URL:** <https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967>\
**Category:** Logstash\
**Created:** [September 19, 2017, 6:57am UTC](https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967 "2017-09-19T06:57:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [September 19, 2017, 6:57am UTC](https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967/1 "2017-09-19T06:57:27Z")

</div>

Hi,

I have a csv file which contains Latitude\_(A),Longitude\_(A),Latitude\_(B),Longitude\_(B) fields. I want to use this data to put on coordinate map in Kibana.

I tried with following configuration:  
mutate {  
convert =\> { "Latitude\_(A)" =\> "float" }  
convert =\> { "Longitude\_(A)" =\> "float" }  
convert =\> { "Latitude\_(B)" =\> "float" }  
convert =\> { "Longitude\_(B)" =\> "float" }  
}

```
  mutate {
      rename => {
          "Latitude_(A)" => "[location][lat]"
          "Longitude_(A)" => "[location][lon]"
           "Latitude_(B)" => "[location][lat]"
          "Longitude_(B)" => "[location][lon]"
      }
  }

```

I tried to create a template for converting this to geo\_point , like below:

"location" : { "type": "geo\_point"}.

But I am not sure how to exactly use this template. Where should I keep this template?

Thanks,

---

<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:** [September 19, 2017, 8:05am UTC](https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967/2 "2017-09-19T08:05:29Z")

</div>

> [@shashwat](#):
>
> mutate {  
> rename =\> {  
> "Latitude\_(A)" =\> "[location][lat]"  
> "Longitude\_(A)" =\> "[location][lon]"  
> "Latitude\_(B)" =\> "[location][lat]"  
> "Longitude\_(B)" =\> "[location][lon]"  
> }  
> }

That's not valid, you will need two geopoint fields if you have two sets of coordinates. Otherwise it just over writes the first set.

---

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [September 19, 2017, 8:09am UTC](https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967/3 "2017-09-19T08:09:33Z")

</div>

Thanks Mark for responding. Yes, I just checked in Kibana and it is overriding the previous one. Can you please help me out to setting up this? How can we provide two geopoint fields?

Thanks,

---

<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:** [September 19, 2017, 8:10am UTC](https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967/4 "2017-09-19T08:10:40Z")

</div>

> [@shashwat](#):
>
> How can we provide two geopoint fields?

Create another mutate + rename for the second location and you should be fine.

---

<div class="post-metadata">

**Author:** ![shashwat](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@shashwat](https://discuss.elastic.co/u/shashwat)\
**Post date:** [September 19, 2017, 12:49pm UTC](https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967/5 "2017-09-19T12:49:45Z")

</div>

Thanks Mark, after putting another block for mutate+rename I can see now both the pair of lat/long but still I am not able to see them on the co-ordinate map. I see the following error:

**"The "mapdata" index pattern does not contain any of the following field types: geo\_point"**

Following is the snapshot for the lat/longs captured:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/2/721f8b2df885aedc752d48d60d8e6d3de659230f.png)

---

<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:** [September 20, 2017, 12:38am UTC](https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967/6 "2017-09-20T00:38:27Z")

</div>

Ok great! Now let's make a change to the config;

```auto
mutate {
  add_field => ["[location][coordinates]", "%{[location][lon]}" ]
  add_field => ["[location][coordinates]", "%{[location][lat]}" ]
}

```

This creates a single `location.coordinates` field, which Kibana needs.

Once you have that working we can look at the mapping.

---

<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:** [October 18, 2017, 12:38am UTC](https://discuss.elastic.co/t/template-creation-for-type-geo-point-in-logstash/100967/7 "2017-10-18T00:38:29Z")

</div>

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