带删除选项的卷曲命令会引发异常

时间:2016-12-19 06:56:10

标签: powershell curl elasticsearch

我一直致力于弹性搜索,我有一些方法可以删除elasticsearch中的一些索引。

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

命令如下:

curl -X DELETE 'http://localhost:9200/logstash-2016.12.19/'

但是当我在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

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:2)

CurlInvoke-WebRequest cmdlet的别名。它没有-X参数,只有-Method

Invoke-WebRequest -Method Delete -Uri 'http://localhost:9200/logstash-2016.12.19/'
相关问题