Elasticsearch: 缺少Content-Type头

2024-04-20 06:31:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用python2.7在AWS Elasticsearch(v6.3)中摄取数据,在添加数据(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 snapshot的json文件。在


Tags: pip数据awsjsonmessageisresponsetype
1条回答
网友
1楼 · 发布于 2024-04-20 06:31:40

从ES6.0Content-Type header is obligatory开始。如果您使用的是this script,那么前面提到的elasticsearchpython库没有任何变化,因为这个脚本不使用这个库。在

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

希望有帮助!在

相关问题 更多 >