[英]adding boost by field to a prefix and match_phrase_prefix queries
我試圖在我的es查詢中將分數提升添加到不同的字段,以便某個字段優先於另一個字段。
我的查詢如下所示:
"query": {
"bool": {
"should": [{
"prefix": {
"title": "נפצ"
}},{
"match_phrase_prefix": {
"sub_title": "נפצע קש"
}
}]
}
}
出於某種原因,使用前綴和match_phrase_prefix似乎無法添加得分助推器。
我想實現的目標應如下所示:
"query": {
"bool": {
"should": [{
"prefix": {
"title": "נפצ"
"score": 2
}
},{
"prefix": {
"sub_title": "נפ"
"score": 1
}
}]
}
}
[編輯]使用boost
應該可以解決問題。 根據文檔 ,類似的東西必須對您有用(盡管我還沒有自己嘗試過):
"query": {
"bool": {
"should": [{
"prefix": {
"title": {
"value": "נפצ",
"boost": 2.0
}
}},{
"match_phrase_prefix": {
"sub_title": {
"query": "נפצע קש",
"boost": 1.0
}
}
}]
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.