简体   繁体   English

elasticsearch 查询 GCP alpha 和 beta api

[英]elasticsearch query for GCP alpha and beta api's

trying to get this query below to work on GCP.试图让下面的查询在 GCP 上工作。 need this to query for beta api's being used every 24 hours.需要它来查询每 24 小时使用一次的 beta api。 keep getting error in the query.不断在查询中出错。 probably a simple syntax error, but im not seeing it.可能是一个简单的语法错误,但我没有看到它。

    GET /gcp-%2A/_search
{
    "query": {
          "range" : {
            "timestamp" : {
                "gte" : "now-1d/d",
                "lt" :  "now/d"
            }
        },
            "wildcard": {
            "protoPayload.methodName": {
                "value": "*beta*",
                "boost": 1.0,
                "rewrite": "constant_score"
            }
        }
    }
}
{
  "error": {
    "root_cause": [
      {
        "type": "parsing_exception",
        "reason": "[range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
        "line": 9,
        "col": 13
      }
    ],
    "type": "parsing_exception",
    "reason": "[range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]",
    "line": 9,
    "col": 13
  },
  "status": 400
}

You were almost there:你几乎在那里:

GET /gcp-%2A/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "timestamp": {
              "gte": "now-1d/d",
              "lt": "now/d"
            }
          }
        },
        {
          "wildcard": {
            "protoPayload.methodName": {
              "value": "*beta*",
              "boost": 1,
              "rewrite": "constant_score"
            }
          }
        }
      ]
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM