python - Elasticsearch:缺少 Content-Type 标头
问题描述
我正在使用 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
。
我正在摄取 AWS Config 快照的 json 文件。
解决方案
从 ES 6.0 开始Content-Type 标头是强制性的。如果您使用的是这个脚本,那么前面提到的elasticsearch
python 库不会改变任何东西,因为这个脚本不使用这个库。
作为一种解决方法,您可以使用 AWS Elasticsearch 5.6(在您弄清楚如何发送 Content-Type 标头之前应该可以使用)。如果您可以编辑脚本,请考虑手动设置标题(可以在此处找到很好的示例)。另请参阅此答案。
希望有帮助!
推荐阅读
- python - 信号的自回归模型没有变化,不同的实现
- three.js - 三个JS重置Camera动画
- sql - 如何在 informatica Power Center 中删除包含“null”的行
- webpack - 使用 Laravel Mix 在编译的 HTML 文件中查找和替换
- excel - 努力从 excel 打开访问数据库 - 错误 91
- .htaccess - 如何通过重定向删除域上的尾随点
- c++ - 将 char aray 转换为浮点值
- sql-server - 右连接没有从右表中提取所有行
- react-native - React-Native Expo 导航徽章
- sql - SQL中的WTD计算