【问题标题】:Why curl command of elasticsearch is not working in Ubuntu?为什么弹性搜索的 curl 命令在 Ubuntu 中不起作用?
【发布时间】:2019-08-19 10:26:04
【问题描述】:

当我在 kibana 控制台中编写此查询时,它会显示正确的输出。 我从 kibana 复制 curl 命令,然后在 Ubuntu 终端中运行它,但没有任何效果。

我正在使用这个 curl 命令

curl -XPOST "http://localhost:9200/_sql?format=json" -H 'Content- 
Type: application/json' -d'{ "query": "select * from abusix_1 where 
Date between \"2019-07-29T08:00:45.000Z\" and \"2019-08- 
29T08:00:45.000Z\""}'

它显示了这个输出

{"error":{"root_cause": 
[{"type":"verification_exception","reason":"Found 3 problem(s)\nline 
1:30: Unknown column [Date], did you mean [path]?\nline 1:43: 
Unknown column [2019-07-29T08:00:45.000Z]\nline 1:74: Unknown column 
[2019-08- 
29T08:00:45.000Z]"}],"type":"verification_exception","reason":"Found 
3 problem(s)\nline 1:30: Unknown column [Date], did you mean [path]? 
\nline 1:43: Unknown column [2019-07-29T08:00:45.000Z]\nline 1:74: 
Unknown column [2019-08-29T08:00:45.000Z]"},"status":400}

这些东西我都试过了

1) 我已将双引号改为单引号,不带正斜杠。

2)我已将 "query" 更改为 \"query\"

3)我已将 Date 列更改为 Date_Created

但没有任何效果。那么问题是什么,我该如何解决?

【问题讨论】:

    标签: elastic-stack ubuntu-18.04


    【解决方案1】:

    应该是这样的

    curl -XPOST "http://localhost:9200/_sql?format=json" -H 'Content-Type: 
    application/json' -d "{\"query\": \"select * from abusix_1 where Date between 
    '2019-07-29T08:00:45.000Z' and '2019-08-29T08:00:45.000Z'\"}"
    

    【讨论】:

      猜你喜欢
      • 2021-06-27
      • 2020-10-15
      • 2018-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多