【问题标题】:Elasticsearch '[bool] failed to parse field [filter]'Elasticsearch '[bool] 无法解析字段 [filter]'
【发布时间】:2021-02-07 20:52:16
【问题描述】:

我正在尝试解决我的搜索查询的解析异常。 "type" : "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"
          }
        }
          
        }
      ]
    }
  }
}  

【问题讨论】:

    标签: elasticsearch elasticsearch-query elasticsearch-geo-shape


    【解决方案1】:

    您需要颠倒坐标顺序 b/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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-24
      • 2015-01-26
      • 1970-01-01
      • 2022-01-09
      • 2018-07-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多