elasticsearch.exceptions.RequestError:请求错误(400,“页面不存在”)

nfeuvbwi  于 2023-03-07  发布在  ElasticSearch
关注(0)|答案(1)|浏览(345)

我有这样的疑问:

range_query = {
        "query": {
            "bool": {
                "must": [
                    {
                        "match": {
                            "type": DEFAULT_LOG_TYPE
                        },
                        "match": {
                            "namespace": namespace
                        }
                    },
                    {
                        "range": {
                            "@timestamp": {
                                "gte": ts,
                                "lte": te
                            }
                        }
                    }
                ]
            }
        }, "_source": ["message", "@timestamp"]
    }

ad当我在kibana上运行这两个命令时,我可以看到我有_source文件:

GET /my_index/_doc/doc_id and GET /my_index/_field_caps?fields=*&include_unmapped=true

知道为什么我会得到这个错误吗?我还尝试添加"docvalue_fields":["消息"],我得到错误:

elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', 'request does not support [docvalue_fields]')

有什么办法解决这个问题吗?

rqcrx0a6

rqcrx0a61#

未正确指定匹配子句,它们应如下所示:

range_query = {
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "type": DEFAULT_LOG_TYPE
          }
        },
        {
          "match": {
            "namespace": namespace
          }
        },
        {
          "range": {
            "@timestamp": {
              "gte": ts,
              "lte": te
            }
          }
        }
      ]
    }
  },
  "_source": [
    "message",
    "@timestamp"
  ]
}

相关问题