Could not resolve host: 'localhost 报错解决办法

时间:2022-08-20 17:07:35
Could not resolve host: 'localhost

是我在命令行中使用Curl往Kiabna中导入数据时报的错误。

首先,在Windows中curl命令后面用双引号;

其次,需要加-H "Content-Type: application/x-ndjson"

例如,原来的导入代码是:

curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary @accounts.json 

则改成:

curl -H "Content-Type: application/x-ndjson" -XPOST "localhost:9200/bank/account/_bulk?pretty" --data-binary @accounts.json