带有删除选项的 curl 命令引发异常

Vij*_*yan 2 powershell curl elasticsearch

我一直在研究弹性搜索一段时间,我有删除弹性搜索中的一些索引的方案。

按照 ELK 用户指南中的说明,我尝试CURL在 Windows Server 2012 R2 上使用PowerShell 中的命令删除索引

命令如下

curl -X DELETE 'http://localhost:9200/logstash-2016.12.19/'
Run Code Online (Sandbox Code Playgroud)

但是当我在 PowerShell 中给这个命令删除时,它会抛出以下错误:

Invoke-WebRequest : A parameter cannot be found that matches parameter name 'X'.
At line:1 char:6
+ curl -X DELETE 'http://10.242.244.170:9200/logstash-2016.12.19/'
+      ~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Run Code Online (Sandbox Code Playgroud)

谁能帮我解决这个问题?

Mar*_*ndl 5

CurlInvoke-WebRequestcmdlet的别名。它没有-X参数,只有一个-Method

Invoke-WebRequest -Method Delete -Uri 'http://localhost:9200/logstash-2016.12.19/'
Run Code Online (Sandbox Code Playgroud)