amazon-web-services - RequestError : TransportError(400, u'mapper_parsing_exception', u'解析失败')

标签 amazon-web-services elasticsearch

创建索引:

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/

最佳答案

当我遇到同样的问题时,在我的例子中,我的字典中有 NULL 值,所以在阅读之前检查你的数据或尝试将你的值转换为 str。

关于amazon-web-services - RequestError : TransportError(400, u'mapper_parsing_exception', u'解析失败'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42756922/

相关文章:

elasticsearch - 如何在 Elasticsearch 管道中指定文档版本?

elasticsearch - 向现有索引添加dynamic_date_formats-是否需要重新摄取数据?

regex - LogStash-解析日志

java - 创建变更集时出错 - "DependsOn must be a string or list of strings."

javascript - 将 CORS 与 AWS API Gateway 结合使用有哪些安全隐患?

amazon-web-services - 发现新的启动配置时自动更新 Auto Scaling 组中的 EC2 实例

amazon-web-services - 我不能在 aws fargate 中运行超过 5 个任务

amazon-web-services - 托管静态网站的 S3 存储桶策略

elasticsearch - 密集向量数组和余弦相似度

elasticsearch - 在 ElasticSearch 中,我如何检查数组中的值是否匹配