0
我有一個查詢,可能在所有字段中搜索由下面部分匹配的空格分隔的短語。此外,評分按預期工作,其中「荷蘭Joh」具有較低的得分則「約翰」或‘約翰做’具有較低的得分則「李四」ElasticSearch:Bool查詢計分問題
POST /user/_search
{
"query": {
"match": {
"_all": {
"query": "John Doe",
"operator": "or",
"fuzziness": 2,
"prefix_length": 1
}
}
}
}
我現在想添加一個圖層上這個查詢的頂部,它返回上面'state'字段必須是'California'的結果。我的下面的實現返回了期望的結果,但是現在得分在找到匹配時具有名稱分數。例如'Joh',其中state ='California'返回與'John Doe'相同的分數,其中state ='California'。爲什麼評分不再正常工作?任何解決方案將不勝感激。
GET /user/_search
{
"query": {
"filtered": {
"query": {
"match": {
"_all": {
"query": "John Doe",
"operator": "or"
},
"filter": {
"bool": {
"must": [
{
"term": {
"state": "California"
}
}
]
}
}
}
}
}
}
}
有沒有一種方法,我可以查詢文檔,而無需過濾得那麼正確的評分結果結束後查詢添加過濾器。也許這樣,過濾器不會在查詢之前執行,從而給出正確的結果? – emarel