2016-06-10 46 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'做了一個很棒的工作來解決這個問題。謝謝 –