小编dat*_*her的帖子

Elasticsearch 时间范围查询和数据

我正在努力为 Elastic Search 制定正确的 API 搜索调用,该调用将在过去 1 小时内询问我想要的 ipv4address。

第一次尝试:

curl -X GET "localhost:9200/ipaddresses/_search" -H 'Content-Type: application/json' -d'
     {
       "query": {
         "match": {
           "ipv4address": {
             "query": "50.167.71.25"
           }
         }
       },
       "range": {
         "@timestamp": {
           "gte": "now-1h",
           "lt": "now"
         }
       }
     }
     '
Run Code Online (Sandbox Code Playgroud)

{"error":{"root_cause":[{"type":"parsing_exception","re​​ason":"[range] 中 START_OBJECT 的未知键。","line":10,"col":12}] ,"type":"parsing_exception","re​​ason":"[range] 中 START_OBJECT 的未知键。","line":10,"col":12},"status":400}

第二次尝试:

curl -X GET "localhost:9200/ipaddresses/_search" -H 'Content-Type: application/json' -d'
{
   "query": {
     "match": {
       "ipv4address": {
         "query": "50.167.71.25"
       }
     }
   },
   "fields": {
    "range": {
     "@timestamp": {
      "gte": "now-1h",
      "lt": …
Run Code Online (Sandbox Code Playgroud)

elasticsearch kibana-6

2
推荐指数
1
解决办法
9903
查看次数

标签 统计

elasticsearch ×1

kibana-6 ×1