简体   繁体   English

Elasticsearch:缺少Content-Type标头

[英]Elasticsearch: Content-Type header is missing

I am ingesting data in AWS Elasticsearch (v 6.3) using python 2.7 and while adding data(json) I am getting 我正在使用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}

I have installed latest elasticsearch lib with pip install elasticsearch . 我已经使用pip install elasticsearch安装了最新的elasticsearch lib。

I am ingesting the json files of AWS Config snapshot. 我正在摄取AWS Config快照的json文件。

Starting with ES 6.0 Content-Type header is obligatory . 从ES 6.0开始, 必须提供Content-Type标头 If you are using this script then the aforementioned elasticsearch python library changes nothing since this script does not use this library. 如果您正在使用此脚本,则上述的elasticsearch python库不会发生任何变化,因为此脚本未使用此库。

As a workaround, you could use AWS Elasticsearch 5.6 (should work until you figure out how to send Content-Type header). 作为一种解决方法,您可以使用AWS Elasticsearch 5.6(在弄清楚如何发送Content-Type标头之前,应该可以使用)。 If you can edit the script, consider setting headers manually (good example can be found here ). 如果可以编辑脚本,请考虑手动设置标题(可以在此处找到很好的示例)。 Also see this answer . 另请参阅此答案

Hope that helps! 希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM