# Geo\_point logging from python to elasticsearch

**URL:** <https://discuss.elastic.co/t/geo-point-logging-from-python-to-elasticsearch/37336>\
**Category:** Elasticsearch\
**Created:** [December 16, 2015, 10:00am UTC](https://discuss.elastic.co/t/geo-point-logging-from-python-to-elasticsearch/37336 "2015-12-16T10:00:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![daTokenizer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/datokenizer/32/6658_2.png) [@daTokenizer](https://discuss.elastic.co/u/daTokenizer)\
**Post date:** [December 16, 2015, 10:00am UTC](https://discuss.elastic.co/t/geo-point-logging-from-python-to-elasticsearch/37336/1 "2015-12-16T10:00:07Z")

</div>

Hi folks,  
I am trying for a while to log geo\_point (not geo\_ip) events so i could see them in Kibana using the tilemap feature.  
this prooves difficult. this is a simplified version of the index call i'm using:

```
log_data = {"name": name,
    "Location": Latitude + "," + Longitude}
elf._es.index(index=self._index_name, doc_type=log_type, body=json.dumps(log_data))

```

but `Location` always seems to be mapped into a regular string.

What should I do?

btw, i'm not the only one

> <https://stackoverflow.com/questions/30861405/how-to-add-geo-point-type-data-to-elasticsearch-from-logstash>

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 16, 2015, 10:33am UTC](https://discuss.elastic.co/t/geo-point-logging-from-python-to-elasticsearch/37336/2 "2015-12-16T10:33:47Z")

</div>

Have you set the index's mapping to geo\_point for the `Location` field? ES won't recognize any "x,y" string as a geo\_point.

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [December 16, 2015, 10:39am UTC](https://discuss.elastic.co/t/geo-point-logging-from-python-to-elasticsearch/37336/3 "2015-12-16T10:39:50Z")

</div>

Hi,

I'm not familiar with the python client, but generally for Geo-points you need to define an explicit mapping, since that data type cannot be automatically detected with dynamic mapping (see [here](https://www.elastic.co/guide/en/elasticsearch/guide/current/geopoints.html) for more info on how to do this via the REST interface). You can either add the mapping for that particular field at index creation time or later using the [Put Mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html) Api. In this case it is important that you havent already indexed any document containing that field, otherwise it will already have been mapped automatically to some data type. How this translates to the Python client Api I'm not exactly sure, but it should be pretty straight forward.

---

<div class="post-metadata">

**Author:** ![daTokenizer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/datokenizer/32/6658_2.png) [@daTokenizer](https://discuss.elastic.co/u/daTokenizer)\
**Post date:** [December 17, 2015, 10:23am UTC](https://discuss.elastic.co/t/geo-point-logging-from-python-to-elasticsearch/37336/4 "2015-12-17T10:23:27Z")

</div>

thanks, that helped a lot!

---

<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:** [July 5, 2017, 11:30pm UTC](https://discuss.elastic.co/t/geo-point-logging-from-python-to-elasticsearch/37336/5 "2017-07-05T23:30:14Z")

</div>


