ElasticSearch使用curl导数据报400可能原因

curl -H 'Content-Type: application/x-ndjson'  -s -XPOST 10.0.3.73:9200/yyzj2019-04/trans/_bulk?pretty --data-binary @../test_6000.txt

报错

 1 {
 2   "error" : {
 3     "root_cause" : [ {
 4       "type" : "parse_exception",
 5       "reason" : "Failed to derive xcontent"
 6     } ],
 7     "type" : "parse_exception",
 8     "reason" : "Failed to derive xcontent"
 9   },
10   "status" : 400
11 }

可能原因:

1.仔细检查,命令中的ip、port、还有@后面的文件名路径

2.检查数据文件txt的编码格式,要使用utf-8

3。。。

后续再补充

如有疑问,欢迎留言讨论。
原文地址:https://www.cnblogs.com/zhhy/p/10912130.html