[英]Score based on string in elasticsearch
我有一個字段說“ testField”,其中可以有許多類似的字符串值。 每當字段中的值是特定字符串(例如“ testValue”)時,我都需要提高分數。 如何在Elasticsearch中做到這一點?
您可以嘗試使用function_score
:
{
"query": {
"function_score": {
"query": {
"match_all": {}
},
"functions": [
{
"filter": {
"term": {
"testField": "testValue"
}
},
"boost_factor": 15
}
]
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.