【发布时间】:2017-06-14 03:34:52
【问题描述】:
创建索引:
def create_index(index_name):
es=create_elastic_search_object()
entry_mapping = {
'entry-type': {
'properties': {
'text': {'type': 'string'},
'coordinates': {'type': 'geo_point'},
'username':{'type': 'string'} }
}
}
es.indices.create(index_name,body={'mappings':entry_mapping})
插入索引
coordinates= str(tweet[0][0])+","+str(tweet[0][1])
es.index(index=index_name, doc_type=keyword, id=start_id+ind, body={'text': tweet[1],'coordinates': coordinates,'username': tweet[2]})
错误:
*** RequestError: TransportError(400, u'mapper_parsing_exception', u'failed to parse')
调试:
(Pdb) body={'text': tweet[1],'coordinates': coordinates,'username': tweet[2]}
(Pdb) print body
{'username': 'csd', 'text': 'RT @funder: Court Doc:Trump evicted a disabled US Veteran because he had a therapy dog\n\n@votevets #trumprussia #resist #theresistance #russ...', 'coordinates': '-117.1304909,32.7211149'}
所有格式对我来说都是正确的,我错过了什么?
使用的库:
from elasticsearch import Elasticsearch
【问题讨论】:
-
我有同样的问题,我现在使用的是 ES 版本 5.1
-
我遇到了同样的问题。我怀疑这是因为我正在发送一个不存在的地理点(错误的纬度或经度值)
标签: amazon-web-services elasticsearch