将json数据导入Elastic时,Content-Type标头[application / x-www-form-urlencoded]不支持错误 [英] Content-Type header [application/x-www-form-urlencoded] is not support error when import json data into elastic

查看:291
本文介绍了将json数据导入Elastic时,Content-Type标头[application / x-www-form-urlencoded]不支持错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的我的代码

curl -XPOST "http://localhost:9200/test/p
ost/_bulk/"  -d @City_collection.json

错误:
{错误: Content-Type标头[application / x-www-form-urlencoded]不支持
ed,状态:406}

error: {"error":"Content-Type header [application/x-www-form-urlencoded] is not support ed","status":406}

推荐答案

您需要这样指定内容类型标头

You need to specify the content-type header like this

curl -XPOST "http://localhost:9200/test/post/_bulk/" -H "Content-Type: application/json" -d @City_collection.json
                                                                ^
                                                                |
                                                            add this

这篇关于将json数据导入Elastic时,Content-Type标头[application / x-www-form-urlencoded]不支持错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆