# How to create geo-point fields from longitude / latitude

**URL:** <https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179>\
**Category:** Elasticsearch\
**Created:** [March 14, 2021, 9:38am UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179 "2021-03-14T09:38:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lostsoul352](https://avatars.discourse-cdn.com/v4/letter/l/d2c977/32.png) [@lostsoul352](https://discuss.elastic.co/u/lostsoul352)\
**Post date:** [March 14, 2021, 9:38am UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/1 "2021-03-14T09:38:39Z")

</div>

ELK 7.10.

I've used the geoip filter in logstash to get geo data from a remote IP Address. Now I have geo data appearing in elastic.

I want to be able to map these on a map chart and I don't understand how to do the next step. I know that I have to create a template in elastic to get a field of type geo\_point but I'm not sure how exactly?

In elasticsearch I now have geoip.location.lat and geoip.location.lon which are both number field types. How do I now defined a field called geoip.location which is type geo\_ip?

---

<div class="post-metadata">

**Author:** ![Felix\_Roessel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felix_roessel/32/41623_2.png) [@Felix\_Roessel](https://discuss.elastic.co/u/Felix_Roessel)\
**Post date:** [March 14, 2021, 10:07am UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/2 "2021-03-14T10:07:51Z")

</div>

You need to map geoip.location as geo\_point instead of mapping the lat and lon values

---

<div class="post-metadata">

**Author:** ![lostsoul352](https://avatars.discourse-cdn.com/v4/letter/l/d2c977/32.png) [@lostsoul352](https://discuss.elastic.co/u/lostsoul352)\
**Post date:** [March 14, 2021, 10:37am UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/3 "2021-03-14T10:37:58Z")

</div>

So I mapped a field called location as type geo\_point like this

```
{
  "properties": {
    "location": {
      "type": "geo_point"
    }
  }
}

```

But all I have now is a new mapped field, I'm still getting geoip data but this location field isn't being used in new documents. How do I link latitude and longitude to this location field?

---

<div class="post-metadata">

**Author:** ![Felix\_Roessel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felix_roessel/32/41623_2.png) [@Felix\_Roessel](https://discuss.elastic.co/u/Felix_Roessel)\
**Post date:** [March 14, 2021, 11:26am UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/4 "2021-03-14T11:26:59Z")

</div>

Could you share your logstash Pipeline?

You need to configure the location field as target field for your geo ip filter.

---

<div class="post-metadata">

**Author:** ![lostsoul352](https://avatars.discourse-cdn.com/v4/letter/l/d2c977/32.png) [@lostsoul352](https://discuss.elastic.co/u/lostsoul352)\
**Post date:** [March 14, 2021, 12:03pm UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/5 "2021-03-14T12:03:00Z")

</div>

Okay so I have:-

- mapped a field called location as type geo\_point

- configured the geoip filter in logstash to use location as a target.

Is that right ? It's still not working though. Map chart recognises location as geo-spatial field but I don't see any data

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 14, 2021, 12:38pm UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/6 "2021-03-14T12:38:06Z")

</div>

Is there a typo? `localtion` Vs `location`

---

<div class="post-metadata">

**Author:** ![lostsoul352](https://avatars.discourse-cdn.com/v4/letter/l/d2c977/32.png) [@lostsoul352](https://discuss.elastic.co/u/lostsoul352)\
**Post date:** [March 14, 2021, 12:55pm UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/7 "2021-03-14T12:55:42Z")

</div>

Yes, sorry. But is what I said correct?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 14, 2021, 2:33pm UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/8 "2021-03-14T14:33:25Z")

</div>

I don't believe so. Look at what a document look like after the `geoip` filter.

---

<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:** [April 11, 2021, 2:33pm UTC](https://discuss.elastic.co/t/how-to-create-geo-point-fields-from-longitude-latitude/267179/9 "2021-04-11T14:33:42Z")

</div>

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