Linux 使用位于单独文件中的json运行curl-xput
我想用位于/root目录中的json文件在弹性搜索中创建一个新模板 我运行以下命令:Linux 使用位于单独文件中的json运行curl-xput,linux,curl,
elasticsearch,Linux,Curl,
elasticsearch,我想用位于/root目录中的json文件在弹性搜索中创建一个新模板 我运行以下命令: curl -X PUT 'localhost:9200/_template/template_1?pretty' -H 'Content-Type: application/json' -d /root/myjson 它给了我以下错误: Compressor detection can only be called on some xcontent bytes or compressed xcontent b
curl -X PUT 'localhost:9200/_template/template_1?pretty' -H 'Content-Type: application/json' -d /root/myjson
它给了我以下错误:
Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes
使用放置在特定文件中的数据发送curl命令的正确方法是什么?您收到的错误似乎是ElasticSearch响应,而不是curl错误 基于此示例,我怀疑问题可能是JSON格式错误: 您可以尝试直接在命令行上发送数据,查看是否收到相同的错误,然后通过JSON验证程序运行文件内容