Elasticsearch '[bool] 无法解析字段 [filter]'

Elasticsearch '[bool] failed to parse field [filter]'

我正在尝试解决我的搜索查询的解析异常。 “类型”:“x_content_parse_exception”, “原因”:“[18:9] [bool] 无法解析字段 [filter]” 我希望有一个人可以帮助我 谢谢

GET /g20/_search
{ "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": [
        {"geo_shape": {
          "location": {
            "shape": {
              "type": "envelope",
              "coordinates": [
                [39,-77],
                [38,-76]
              ]
            },
            "relation": "within"
          }
        }
          
        }
      ]
    }
  }
}  

您需要颠倒坐标顺序 b/c 您提供的坐标位于南极洲,而不是 D.C 附近。如您所愿:

GET /g20/_search
{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": [
        {
          "geo_shape": {
            "location": {
              "shape": {
                "type": "envelope",
                "coordinates": [
                  [ -77, 39 ],
                  [ -76, 38 ]
                ]
              },
              "relation": "within"
            }
          }
        }
      ]
    }
  }
}  

envelope spec中,lon后面是lat