【问题标题】:Elastic Search curl command not recognised in WindowsWindows 中无法识别 Elastic Search curl 命令
【发布时间】:2018-09-18 13:56:47
【问题描述】:

我下载了弹性搜索并在我的 Windows 笔记本电脑上运行了 elasticsearch.bat,但我一尝试: 卷曲http://localhost:9200 我明白了:

C:\Temp\elasticsearch-6.4.0\bin>curl http://localhost:9200/
'curl' is not recognized as an internal or external command,
operable program or batch file.

我错过了什么?我按照以下设置说明进行操作: https://www.elastic.co/downloads/elasticsearch

'Invok _restMethod' 也会在 power shell 上报错:

PS C:\Temp\elasticsearch-6.4.0\bin> Invoke-RestMethod http://localhost:9200
**The term 'Invoke-RestMethod' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.**
At line:1 char:18
+ Invoke-RestMethod <<<<  http://localhost:9200
    + CategoryInfo          : ObjectNotFound: (Invoke-RestMethod:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

【问题讨论】:

  • curl 的可执行位置是否在 PATH 变量中?
  • 因为powershell版本。我遇到了这个问题,根据@Leo Bartkus 的评论,我升级了我的powershell,powershell 可以识别curl 命令。

标签: elasticsearch


【解决方案1】:

curl 是一个单独运行的 exe,您可以从以下链接下载它 https://curl.haxx.se/download.html

或者

您可以在命令提示符下使用以下命令运行 elasticsearch

bin\elasticsearch.bat

或者

您可以使用以下命令将弹性搜索安装为服务

elasticsearch-service.bat 安装

参考

https://efficientuser.com/2016/11/01/installing-elasticsearch-5-0-as-service-on-windows/

【讨论】:

  • 谢谢。在运行 elasticsearch.bat 之后,我正在查看链接中的第 3 步。我为windows安装了curl,仍然是同样的错误。 InvokeMethod' 也不起作用,我发布了错误。
  • 我从未尝试过第一步。我已经使用了最后两个步骤,我很确定它会起作用。
  • 如果您认为答案对您有帮助,请点赞
【解决方案2】:

你在 windows 上,所以就像文档说的那样,使用 powershell 并运行这个:

Invoke-RestMethod http://localhost:9200 

【讨论】:

  • 它不起作用,我上传了错误的图片。谢谢你。我还为windows安装了curl,还是不行。
  • 您使用的是最新的 powershell 版本吗?此命令适用于 powershel 5.1 版您可以使用 $PSVersionTable.PSVersion 进行检查
  • 如果您有旧版本的 powershell,以下是解决问题的方法。 codehollow.com/2016/02/invoke-webrequests-via-powershell
猜你喜欢
  • 2018-06-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-09
  • 2016-04-20
  • 2016-06-05
  • 2017-11-19
相关资源
最近更新 更多