在elasticsearch中使用minimum_match内部过滤器



我正在尝试建立一个弹性调用,我想在一个窗帘区域设置一些过滤器,我想做的是这样的:

{
    "query" : {
        "filtered" : {
            "query"  : {
                "match_all" : { }
            },
            "filter" : {
                "and" : [
                    {
                        "bool" : {
                            "must" : {
                                "terms" : {
                                    "my_filter"     : [1, 2, 4],
                                    "minimum_match" : 3
                                }
                            }
                        }
                    },
                    {
                        "geo_distance" : {
                            "location" : "56.20123,14.3240234",
                            "distance" : "30km"
                        }
                    }
                ]
            }
        }
    }
}

然而,当我尝试这一切,我得到的是"minimum_match是不允许的条件在过滤器,有什么办法吗?

我尝试使用bool作为查询,但我不允许过滤

您可以尝试查询minimum_match吗?如下

{
   "query": {
      "filtered": {
         "query": {
            "match_all": {}
         },
         "filter": {
            "and": {
               "filters": [
                  {
                     "query": {
                        "terms": {
                                "my_filter"     : [1, 2, 4],
                                "minimum_match" : 3
                        }
                     }
                  },
                  {
                     "geo_distance": {
                        "location": "56.20123,14.3240234",
                        "distance": "30km"
                     }
                  }
               ]
            }
         }
      }
   }
}

最新更新