Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
elasticsearch 中有很多评分/提升选项,但我还没有找到为特定字段添加恒定提升值的可能性。如果存在这样的选项,映射应该是什么样子?也许有一个选项可以根据被击中的字段来计算整个文档的分数?
这是解决方案:包装查询“custom_boost_factor”将每种类型的嵌入式查询的分数相乘:
curl -XPOST 'http://localhost:9200/test/entry/_search?pretty=true' -d '{ "query":{ "custom_boost_factor" :{ "query" : { "text_phrase_prefix" : { "title" : "test" } }, "boost_factor": 2.0 } } }'