2016-06-10 125 views
1

我想删除Windows中的elasticsearch模板,但是它一直给我这样的错误结果。删除Windows中的elasticsearch模板

PS C:\Users\Administrator> curl -XGET localhost:9200/_template/ 
Invoke-WebRequest : A parameter cannot be found that matches parameter name 'XGET'. 
At line:1 char:6 
+ curl -XGET localhost:9200/_template/ 
+  ~~~~~ 
    + CategoryInfo   : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException 
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand 



PS C:\Users\Administrator\Downloads\curator> curl GET localhost:9200/_template/ 
Invoke-WebRequest : A positional parameter cannot be found that accepts argument 'localhost:9200/_template/'. 
At line:1 char:1 
+ curl GET localhost:9200/_template/ 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException 
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand 

有无论如何解决问题吗?

回答

1

curl是用于Invoke-WebRequest小命令的别名:

get-command curl | select Name 

Name 
---- 
curl 

-XGET相当于-Method Get这是缺省值。所以这应该工作:

Invoke-WebRequest 'http://localhost:9200/_template/' 

注意:您可能必须采用该计划。

+0

那么我该如何彻底删除一个模板和索引 –

+0

我不知道elasticsearch API,可能你必须在'-Method'参数上使用'Delete'动词。 –

+1

我不小心发现google chrome扩展插件'postman'做了一个很棒的工作来解决这个问题。谢谢 –