【问题标题】:Elasticsearch: Content-Type header is missingElasticsearch:缺少 Content-Type 标头
【发布时间】:2018-08-21 03:53:10
【问题描述】:

我正在使用 python 2.7 在 AWS Elasticsearch (v 6.3) 中摄取数据,并在添加数据(json)时得到

response: {"error":"Content-Type header is missing","status":406}...message: {"error":"Content-Type header is missing","status":406}

我已经使用pip install elasticsearch 安装了最新的 elasticsearch 库。

我正在摄取 AWS Config 快照的 json 文件。

【问题讨论】:

    标签: python elasticsearch


    【解决方案1】:

    从 ES 6.0 Content-Type header is obligatory 开始。如果您使用的是this script,那么前面提到的elasticsearch python 库不会改变任何内容,因为这个脚本不使用这个库。

    作为一种解决方法,您可以使用 AWS Elasticsearch 5.6(在您弄清楚如何发送 Content-Type 标头之前应该可以使用)。如果您可以编辑脚本,请考虑手动设置标题(可以找到很好的示例here)。另见this answer

    希望有帮助!

    【讨论】:

    • 是的,我正在使用该脚本。谢谢建议,明天试试。
    猜你喜欢
    • 2021-09-18
    • 1970-01-01
    • 1970-01-01
    • 2019-04-04
    • 2016-08-24
    • 1970-01-01
    • 1970-01-01
    • 2018-04-06
    • 2016-12-04
    相关资源
    最近更新 更多