Elasticsearch:缺少Content-Type标头

时间:2018-08-20 19:15:52

标签: python elasticsearch

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

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

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

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

1 个答案:

答案 0 :(得分:0)

从ES 6.0 Content-Type header is obligatory开始。如果您使用的是this script,则上述elasticsearch python库不会发生任何变化,因为此脚本未使用此库。

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

希望有帮助!

相关问题