相关疑难解决方法(0)

Elasticsearch:无法过滤多个字段

我想过滤一下 { "query" : { "match_all" :{}}}弹性搜索,但我不明白......

这是我发送给ES _search方法的内容.

curl -XGET http://localhost:9200/users/location/_search '-H Accept: application/json' '-H Content-Type: application/json'
-d '{
   "query":{
      "match_all":{}
   },
   "filter":{
      "and":{
         "geo_distance":{
            "distance":"500km",
            "location":{
               "lat":48.8,
               "lon":2.33
            }
         },
         "term":{
            "status":1
         }
      }
   },
   "sort":[
      {
         "_geo_distance":{
            "location":[
               2.33,
               48.8
            ],
            "order":"asc",
            "unit":"km"
         }
      }
   ]
}' 
Run Code Online (Sandbox Code Playgroud)

但我总是得到这个错误:

nested: QueryParsingException[[users] [and] filter does not support [distance]]
Run Code Online (Sandbox Code Playgroud)

如果我删除该"and" :{}选项并仅对geo_distance进行过滤,则可以正常工作......任何帮助都会非常棒.

干杯

elasticsearch

2
推荐指数
1
解决办法
7359
查看次数

标签 统计

elasticsearch ×1