# Geo point as string

**URL:** <https://discuss.elastic.co/t/geo-point-as-string/50637>\
**Category:** Elasticsearch\
**Created:** [May 22, 2016, 3:20am UTC](https://discuss.elastic.co/t/geo-point-as-string/50637 "2016-05-22T03:20:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suran\_Kularatna](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Suran\_Kularatna](https://discuss.elastic.co/u/Suran_Kularatna)\
**Post date:** [May 22, 2016, 3:20am UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/1 "2016-05-22T03:20:32Z")

</div>

I have created a python tweepy script and it's all working fine loading data into elastic search.

I recentyl added functionality to get coordinates from tweets and am having a struggle trying to add it to my map

here's what i have :

mapping={  
"twitter-map": {  
"properties": {  
"author":{"type": "string"},  
"date":{"type": "date","format": "EEE MMM dd HH:mm:ss Z yyyy"},  
"message":{"type": "string", "index": "not\_analyzed"},  
"urls":{"type": "string", "index": "not\_analyzed"},  
"hashtags":{"type": "string", "index": "not\_analyzed"},  
"url\_keywords":{"type": "string", "index": "not\_analyzed"},  
"title":{"type": "string", "index": "not\_analyzed"},  
"summary":{"type": "string", "index": "not\_analyzed"},  
"location":{"type": "geo\_point"},

```
                                                    }
                                            }
                                    }

                                    es.indices.put_mapping(index="fin-tech",doc_type="twitter-map",body=mapping)

                                    content={"author":dict_data["user"]["screen_name"],
                                          "date":dict_data["created_at"],
                                          "message": dict_data["text"],
                                          "urls":[url["expanded_url"]for url in dict_data["entities"]["urls"]],
                                          "hashtags":[hashtag['text']for hashtag in dict_data["entities"]["hashtags"]],
                                          "location":dict_data["user"]["location"],
                                          "url_keywords":keywords,
                                          "title":title,
                                          "summary":summary,
                                          "location":coord}

```

when executing the python script i get : lasticsearch.exceptions.RequestError: TransportError(400, 'illegal\_argument\_exception', 'mapper [location] of different type, current\_type [string], merged\_type [geo\_point]')  
Surans-Mac-Pro:twitter surankularatna$ vi stream\_data\_fintech.py

any ideas?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 22, 2016, 7:47am UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/2 "2016-05-22T07:47:59Z")

</div>

What does your data look like? Which version of Elasticsearch are you using?

---

<div class="post-metadata">

**Author:** ![xdzhou](https://avatars.discourse-cdn.com/v4/letter/x/9de053/32.png) [@xdzhou](https://discuss.elastic.co/u/xdzhou)\
**Post date:** [May 23, 2016, 7:39am UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/3 "2016-05-23T07:39:58Z")

</div>

two "location" fields in the content?

---

<div class="post-metadata">

**Author:** ![Suran\_Kularatna](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Suran\_Kularatna](https://discuss.elastic.co/u/Suran_Kularatna)\
**Post date:** [May 23, 2016, 3:58pm UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/4 "2016-05-23T15:58:18Z")

</div>

this is the output from pytohn code for coordinates

[-71.7536, 42.5265]

I believe I am using version 2.3.2 Lucene 5.5.0

here's my map

mapping={  
"twitter-map": {  
"properties": {  
"author":{"type": "string"},  
"date":{"type": "date","format": "EEE MMM dd HH:mm:ss Z yyyy"},  
"message":{"type": "string", "index": "not\_analyzed"},  
"urls":{"type": "string", "index": "not\_analyzed"},  
"hashtags":{"type": "string", "index": "not\_analyzed"},  
"url\_keywords":{"type": "string", "index": "not\_analyzed"},  
"title":{"type": "string", "index": "not\_analyzed"},  
"summary":{"type": "string", "index": "not\_analyzed"},  
"location":{"type": "geo\_point"},

```
                                                    }
                                            }
                                    }

                                    es.indices.put_mapping(index="fin-tech",doc_type="twitter-map",body=mapping)

                                    content={"author":dict_data["user"]["screen_name"],
                                          "date":dict_data["created_at"],
                                          "message": dict_data["text"],
                                          "urls":[url["expanded_url"]for url in dict_data["entities"]["urls"]],
                                          "hashtags":[hashtag['text']for hashtag in dict_data["entities"]["hashtags"]],
                                          "location":dict_data["user"]["location"],
                                          "url_keywords":keywords,
                                          "title":title,
                                          "summary":summary,
                                          "location":location}
```

---

<div class="post-metadata">

**Author:** ![Suran\_Kularatna](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Suran\_Kularatna](https://discuss.elastic.co/u/Suran_Kularatna)\
**Post date:** [May 24, 2016, 3:04am UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/5 "2016-05-24T03:04:09Z")

</div>

i am trying this mapping:

"geolocation": {  
"type":'geo\_point',  
"properties": {  
"location":{"type": "string"}

but i get error

elasticsearch.exceptions.RequestError: TransportError(400, 'mapper\_parsing\_exception', 'Mapping definition for [geolocation] has unsupported parameters: [properties : {location={type=string}}]')

---

<div class="post-metadata">

**Author:** ![Suran\_Kularatna](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Suran\_Kularatna](https://discuss.elastic.co/u/Suran_Kularatna)\
**Post date:** [May 24, 2016, 12:22pm UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/6 "2016-05-24T12:22:20Z")

</div>

ive deleted..

---

<div class="post-metadata">

**Author:** ![xdzhou](https://avatars.discourse-cdn.com/v4/letter/x/9de053/32.png) [@xdzhou](https://discuss.elastic.co/u/xdzhou)\
**Post date:** [May 24, 2016, 4:10pm UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/7 "2016-05-24T16:10:41Z")

</div>

this is not how you write mappings. you can refer to default logstash mapping and see how geoip.location is defined. Basically, geoip is a json object, the type is "object", the location is a child of geoip, its type is geo\_point.

geoip: {  
dynamic: true,  
type: "object",  
properties: {  
ip: {  
type: "ip",  
doc\_values: true  
},  
latitude: {  
type: "float",  
doc\_values: true  
},  
location: {  
type: "geo\_point",  
doc\_values: true  
},  
longitude: {  
type: "float",  
doc\_values: true  
}  
}  
},

---

<div class="post-metadata">

**Author:** ![Suran\_Kularatna](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Suran\_Kularatna](https://discuss.elastic.co/u/Suran_Kularatna)\
**Post date:** [May 27, 2016, 2:05am UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/8 "2016-05-27T02:05:47Z")

</div>

thanks I will try this.

---

<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, 10:48pm UTC](https://discuss.elastic.co/t/geo-point-as-string/50637/9 "2017-07-05T22:48:42Z")

</div>


