【问题标题】:Elasticsearch: running commands in Windows prompt and 'pretty' causes errorElasticsearch:在 Windows 提示符和“漂亮”中运行命令会导致错误
【发布时间】:2015-02-22 02:51:24
【问题描述】:

我正在学习 Elasticsearch,并在 Windows 提示符下运行以下命令:

curl -XPOST http://127.0.0.1:9200/test-index/_search?size=0&pretty -d @executing_an_aggregation.json

这是execution_an_aggregation.json的内容

{
    "query": {
        "match_all": {}
    },
    "aggs": {
        "tag": {
            "terms": {
                "field": "tag",
                "size": 10
            }
        }
    }
}

但是,我得到了以下信息:

{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":980 ,"max_score":0.0,"hits":[]}}'pretty' 不是内部或外部命令、可运行程序或批处理文件。

请注意,“漂亮”会导致错误。如何在 Windows 中获得漂亮的结果?

谢谢!

【问题讨论】:

  • 你试过pretty=true吗?
  • 我试过了,但没有用。我正在使用 Elasticsearch Cookbook 来学习 Elasticsearch,我使用的命令是从这本书中复制而来的。
  • 看起来像一个命令行问题 - 与弹性搜索无关。尝试转义 URL -> curl -XPOST 'http://127.0.0.1:9200/test-index/_search?size=0&pretty' -d @executing_an_aggregation.json。如果这无助于查看 curl 语法(可能取决于您的环境 - 可能是 curl -help
  • 使用'127.0.0.1:9200/test-index/_search?size=0&pretty'后出现这个错误: curl: (1) Protocol 'http not supported or disabled in libcurl 'pretty'' is not识别为内部或外部命令,可操作程序或批处理文件。

标签: elasticsearch


【解决方案1】:

使用双引号,而不是简单的。在权威指南中,所有内容都在 Unix-live 环境中进行了测试。

curl -XPOST "http://127.0.0.1:9200/blog/_search?size=0&pretty" -d @executing_an_aggregation.json

【讨论】:

  • 如何传递文件的完整路径?
猜你喜欢
  • 1970-01-01
  • 2021-07-17
  • 2018-09-15
  • 1970-01-01
  • 2020-03-21
  • 2012-07-07
  • 2020-10-31
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多