Geo point as string

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?

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

two "location" fields in the content?

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}

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}}]')

ive deleted..

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
}
}
},

thanks I will try this.