【问题标题】:RequestError: TransportError(400, u'mapper_parsing_exception', u'failed to parse')RequestError: TransportError(400, u'mapper_parsing_exception', u'解析失败')
【发布时间】: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

https://elasticsearch-py.readthedocs.io/en/master/

【问题讨论】:

  • 我有同样的问题,我现在使用的是 ES 版本 5.1
  • 我遇到了同样的问题。我怀疑这是因为我正在发送一个不存在的地理点(错误的纬度或经度值)

标签: amazon-web-services elasticsearch


【解决方案1】:

当我遇到同样的问题时,就我而言,我的 dict 中有 NULL 值,所以只需检查您的数据或尝试在读取之前将您的值转换为 str。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-21
    • 1970-01-01
    • 2017-01-22
    • 2015-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多