【发布时间】:2017-05-06 05:04:18
【问题描述】:
我对 ElasticSearch Query DSL 的查询上下文和过滤上下文有点困惑。我有以下 2 个查询。两个查询都返回相同的结果,第一个评估分数,第二个不评估。哪个更合适?
第一个查询:-
curl -XGET 'localhost:9200/xxx/yyy/_search?pretty' -d'
{
"query": {
"bool": {
"must": {
"terms": { "mcc" : ["5045","5499"]}
},
"must_not":{
"term":{"maximum_flag":false}
},
"filter": {
"geo_distance": {
"distance": "500",
"location": "40.959334, 29.082142"
}
}
}
}
}'
第二次查询:-
curl -XGET 'localhost:9200/xxx/yyy/_search?pretty' -d'
{
"query": {
"bool" : {
"filter": [
{"term":{"maximum_flag":true}},
{"terms": { "mcc" : ["5045","5499"]}}
],
"filter": {
"geo_distance": {
"distance": "500",
"location": "40.959334, 29.082142"
}
}
}
}
}'
谢谢,
【问题讨论】:
-
这个SO 可能会有所帮助!
标签: apache elasticsearch lucene