Elasticsearch 查询问题 - [range] 格式错误的查询,预计 [END_OBJECT] 但发现 [FIELD_NAME]

Problem with Elasticsearch query - [range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]

我无法弄清楚以下查询有什么问题。

GET website/_search
{
  "query": {
    "bool": { 
      "filter": [
        {
          "range": {
            "@timestamp": {
            "gte": "now-1d/d",
            "lt": "now/d"
            }
          },
          "match": {
            "aspnet-request-url.keyword": "abc.com/Default.aspx"
          }
        }
      ] 
    }
  }
}

rangematch 都可以独立工作。

根据文档,它说当合并多个查询时,我们应该在 bool 查询下使用 mustfiltermust-not

它还在给 [range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]

感谢任何帮助。

[range] malformed query, expected [END_OBJECT] but found [FIELD_NAME]

从上面的错误可以看出,查询的格式不正确。请参阅此以了解更多有关 query and filter context.

的结构

您缺少一些括号,请尝试以下搜索查询

{
  "query": {
    "bool": {
      "filter": [
        {
          "range": {
            "@timestamp": {
              "gte": "now-1d/d",
              "lt": "now/d"
            }
          }
        },
        {                          <-- note this
          "match": {
            "aspnet-request-url.keyword": "abc.com/Default.aspx"
          }
        }
      ]
    }
  }
}