在bool过滤器

时间:2015-06-11 15:56:45

标签: elasticsearch

我尝试将geo_shape Elasticsearch过滤器与term过滤器中的基本bool过滤器结合使用,因此我可以尝试提高弹性搜索查询的性能,很少成功。

此查询用于Elasticsearch中的一组多边形,以确定指定点所在的形状。

好像,除非我有错误的结尾,geo_shape过滤器不能包含在bool过滤器集合中,如下所示:

{
"size": 1000,
"fields": [],
"query": {
"filtered": {
  "query": {
    "match_all": {}
  },
  "filter": {
    "bool": {
      "must": [
        {
          "geo_shape": {
            "deliveryAreas.area": {
              "shape": {
                "coordinates": [
                  -0.126208,
                  51.430874
                ],
                "type": "point"
              }
            }
          }
          },
          {
           "term": {
            "restaurantState": 3
           }
          }
         ]
        }
      }
    }
  }
}

上面的查询运行,但返回0结果。在geo_shape之外使用bool查询工作正常,但两者的组合似乎失败了。我认为它必定是语法错误,因为ElasticSearch文档建议这种方法使昂贵的geo调用更便宜,但到目前为止没有运气。

0 个答案:

没有答案