我对 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"
}
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
第二个查询:-
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"
}
}
}
}
}'
Run Code Online (Sandbox Code Playgroud)
谢谢,