这有很多,但你想研究“提升”。这可以在 映射级别 或者 查询级别 。
映射示例:
{ "mappings": { "_doc": { "properties": { "location": { "type": "keyword", "boost": 2 <--- 2x boost to the final score } } } } }
查询示例:
GET /_search { "query": { "bool": { "must": { "match": { "content": { "query": "full text search", "operator": "and" } } }, "should": [ { "term": { "location": { "value": "xxx", "boost": 3 <--- 3x boost if the location matches } }} ] } } }