You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows环境下无法使用Elasticsearch _bulk API求助

Elasticsearch _bulk API 索引问题解决方法
  • 错误原因1:引号格式不兼容
    Windows CMD环境不支持用单引号(')包裹curl参数,单引号会被解析成参数的一部分,导致application被误识别为主机名,触发“无法解析主机: application”错误。Linux下常用的单引号在Windows CMD中必须替换为双引号(")。

  • 错误原因2:API路径拼写错误
    命令中的_bluk是拼写错误,Elasticsearch批量API的正确路径为_bulk,拼写错误直接引发“URL格式非法”问题。

修正后的CMD命令

curl -k -H "Content-Type: application/x-ndjson" -X POST "https://localhost:9200/bank/_bulk?pretty" -d @accounts.json

PowerShell环境适配方案

PowerShell中@会被当作变量引用符号,需调整-d参数写法:

curl -k -H "Content-Type: application/x-ndjson" -X POST "https://localhost:9200/bank/_bulk?pretty" -d $(Get-Content accounts.json -Raw)

内容的提问来源于stack exchange,提问作者Tushar singh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 10:15:33