我需要修改此查詢,以便彈性搜索而不是給它一個分數。我希望我的自定義篩選分數是唯一給予任何結果得分的東西。我該如何做到這一點?在彈性搜索中過濾器查詢無分數
每個記錄只應每有一個得分爲0,100,或1000
{
"size":50,
"from":0,
"query" : {
"custom_filters_score" : {
"query" : {
"filtered" : {
"query" : {
"bool" : {
"must" : [
{"term":{"type":"alpha"}},
{"field":{"sector":"exists"}},
{"field":{"sector.sub":"exists"}},
{"field":{"alpha_sector.sub.categories":"second"}},
{"field":{"beta_sector.sub.columns":"first"}},
{"term":{"beta_type":"beta"}},
{"term":{"area":"624"}}
]
}
},
"filter" : {
"or" : [
{
"and" : [
{"term":{"area":"624"}},
{"term":{"start":"07242013"}}
]
},
{
"and" : [
{"term":{"area":"624"}},
{"term":{"start":"blank"}}
]
}
]
}
}
},
"filters" : [
{"filter":{"term":{"resource":5726}}, "boost":"1000"},
{"filter":{"term":{"alpha_resource":5726}}, "boost":"100"}
],
"score_mode":"sum"
}
}
}
感謝您的回覆,我對實際字段進行了模糊處理,因爲它們非常敏感,因此查詢的數據部分可能無法完成的感覺,但結構是準確的,我會給這個測試wh我從其他正在工作的東西中爬出來,並讓它知道它是否有效! – Aristata
這就像一個魅力,非常感謝你! – Aristata
嗨@imotov - 你介意看看[這個問題](http://stackoverflow.com/questions/37372951/elasticsearch-query-time-boosting-produces-result-in-inadequate-order?noredirect=1#comment62264775_37372951 )我的嗎? – BentCoder