如何从Windows命令终端获取json查询结果

时间:2019-05-28 13:10:52

标签: json elasticsearch command kibana

我有一个要通过命令行传递的json查询

我尝试用双引号替换外部单引号,但仍然显示错误

curl -XGET "http://localhost:9200/honda/_search?pretty" -H 'Content-Type: 
application/json' -d “@{“query”:{"match":{"color":"silver"}}}”

预期:与field:silver匹配的文档 实际错误:警告:     无法从文件“”中读取数据,这将导致一个空的POST

THEN DISPLAYS MY ALL MY DOCUMENTS:

    {
    "_index" : "honda",
    "_type" : "_doc",
    "_id" : "234",
    "_score" : 1.0,
    "_source" : {
      "model" : "Accord EX",
      "price" : 28000,
      "color" : "red",
      "num_doors" : 4,
      "weight" : "9000lbs"
    }
  }.................................
curl: (6) Could not resolve host: application
{"query":{"match":{"color":"silver"}}}"
The filename, directory name, or volume label syntax is incorrect.

1 个答案:

答案 0 :(得分:0)

尝试转义字符以引号。