elasticsearch 如何从弹性搜索中获取最近30分钟的记录,elasticsearch,postman,elasticsearch,Postman" /> elasticsearch 如何从弹性搜索中获取最近30分钟的记录,elasticsearch,postman,elasticsearch,Postman" />

elasticsearch 如何从弹性搜索中获取最近30分钟的记录

elasticsearch 如何从弹性搜索中获取最近30分钟的记录,elasticsearch,postman,elasticsearch,Postman,执行服务时邮递员出错: “根本原因”:[ { “类型”:“编号\格式\例外”, “原因”:“对于输入字符串:\“now()-30m” } ] 请告诉我如何更正。在中使用的正确语法如下: I am using following query to fetch all last 30 minutes records using elastic search, but I'm getting parsable error on line "now-30m". Query: { "

执行服务时邮递员出错: “根本原因”:[ { “类型”:“编号\格式\例外”, “原因”:“对于输入字符串:\“now()-30m” } ]


请告诉我如何更正。

在中使用的正确语法如下:

I am using following query to fetch all last 30 minutes records using elastic search, but I'm getting parsable error on line "now-30m".



    Query: 
{

  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "appName": "magnus-alerting-system"
          }
        },
        {
          "match": {
            "countryCode": "US2"
          }
        },
        {
          "match": {
            "eventCode": 201
          }
        },
        {
          "match": {
            "extractName": "LaborDemand"
          }
        },{
          "range": {
            "eventPostTimestamp": {
              **"gte": "now()-30m"**
            }
          }
        }

      ]
    }
  }
}

在中使用的正确语法如下所示:

I am using following query to fetch all last 30 minutes records using elastic search, but I'm getting parsable error on line "now-30m".



    Query: 
{

  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "appName": "magnus-alerting-system"
          }
        },
        {
          "match": {
            "countryCode": "US2"
          }
        },
        {
          "match": {
            "eventCode": 201
          }
        },
        {
          "match": {
            "extractName": "LaborDemand"
          }
        },{
          "range": {
            "eventPostTimestamp": {
              **"gte": "now()-30m"**
            }
          }
        }

      ]
    }
  }
}
原因是elasticsearch中的now()-30m是错误的,因为正确的格式只是“now”。

因此,正确的查询如下所示:

{
  "range": {
    "eventPostTimestamp": {
      "gte": "now-30m"
    }
  }
}
原因是elasticsearch中的now()-30m是错误的,因为正确的格式只是“now”。

因此,正确的查询如下所示:

{
  "range": {
    "eventPostTimestamp": {
      "gte": "now-30m"
    }
  }
}