Delete elasticsearch template in Windows

I am trying to delete elasticsearch template in Windows, however, it keeps giving me error result like this.

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

Is there anyway to resolve the issues?

This is more of a PowerShell question. The examples in the Logstash documentation assumes you're running the real curl. It looks like you're running some kind of PowerShell script with the same name that doesn't accept the same parameters.

In this particular case whatever it is you're running should default to GET so you should be able to drop the -X option.

But even I drop -X, the result is still error as shown in my question. It turns out that I can only run the command Invoke-WebRequest 'http://localhost:9200/_template/'. However, I would like to know how can I completely remove an index and template.

This issue is due to whenever I chhange some codes in the original logstash conf file, i.e. change the elasticsearch output template or change a fieldtype from string to int, the index created can't overwrite the original template and I always need to create a new index in kibana instead making the old index make changes.

Therefore, I would wonder how can I resolve the issues

But even I drop -X, the result is still error as shown in my question.

I meant dropping the whole option, i.e. remove -XGET.

However, I would like to know how can I completely remove an index and template.

If you can't get REST calls working in PowerShell you can try a web browser extension like Postman.

Yes, postman did a great work. Thanks so much for your reference.