我有一個查詢的作品,其中包括一些過濾器:Elasticsearch must_not過濾掉不與一大束值
{
"from": 0,
"query": {
"function_score": {
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"term": {
"idpais": [
115
]
}
},
{
"term": {
"tipo": [
1
]
}
}
],
"must_not": [
{
"term": {
"idregistro": [
5912471,
3433876,
9814443,
11703069,
6333176,
8288242,
9924922,
6677850,
11852501,
12530205,
4703469,
12776479,
12287659,
11823679,
12456304,
12777457,
10977614,
...
]
}
}
]
}
},
"query": {
"bool": {
"should": [
{
"match_phrase": {
"area": "Coordinator"
}
},
{
"match_phrase": {
"company": {
"boost": 5,
"query": "IBM"
}
}
},
{
"match_phrase": {
"topic": "IT and internet stuff"
}
},
{
"match_phrase": {
"institution": {
"boost": 5,
"query": "University of my city"
}
}
}
]
}
}
}
},
"script_score": {
"params": {
"idpais": 115,
"idprovincia": 0,
"relationships": []
},
"script_id": "ScoreUsuarios"
}
}
},
"size": 24,
"sort": [
{
"_script": {
"order": "desc",
"script_id": "SortUsuarios",
"type": "number"
}
}
]
}
的must_not濾波器具有一大束值,以排除(大約200個值),但它看起來像elasticsearch忽略這些值,它包含在結果集中。如果我嘗試僅設置一些值(10到20個值),那麼elasticsearch會應用must_not過濾器。
在過濾器中存在一定數量的限制嗎?是否存在某種方法從查詢中刪除大量結果?
你有沒有使用術語(注意字母'')而不是'term'沒有s? – CodeNotFound
@CodeNotFound謝謝。謝謝,我從來沒有注意到關於「條款」指令 –
它工作:D? – CodeNotFound