首页 > 解决方案 > 在 ElasticSearch 中返回高质量的结果

问题描述

我将搜索查询发送到我的 ES 索引并返回多个结果。很多时候,分数较低的结果是无关紧要的,我想删除这些结果并只返回高质量的结果(通常有更高的分数)。

我的索引包含 1000 个 100-500 字的文本类型文档。例如 -{"text":'AVENGERS: ENDGAME is set after Thanos' catastrophic use of the Infinity Stones randomly wiped out half of Earth's population in Avengers: Infinity War. Those left behind are desperate to do something -- anything -- to bring back their lost loved ones. But after an initial attempt -- with extra help from Captain Marvel -- creates more problems than solutions, the grieving, purposeless Avengers think all hope is lost.'}

如果用户搜索“Captain Marvel aka Brie Larson 在电影中杀死了灭霸”,则上述文档应作为结果返回,因为它包含类似的术语。

目前,我正在使用 min_score 来设置阈值,但我知道这不是最佳实践,并且分数取决于索引中的文档数量(将不断增长)。所以这种方法似乎不可扩展。

我还尝试了多种方法来调整查询以获取高质量的结果,例如 More Like This 功能

"must": 
[{"more_like_this" : {
"fields" : field_list,
"like" : query_data,
"min_term_freq" : 1,
"max_query_terms" : 50,
"min_doc_freq" : 1,
"minimum_should_match" : '50%'}}]}}

但是我仍然得到像 1.5 这样的低分结果,而高质量的结果通常有 20 分。有没有更好的方法来进一步调整查询或将 min_score 调整为动态以仅返回高度相关的文档?任何帮助,将不胜感激!

标签: elasticsearchmorelikethis

解决方案


推荐阅读