简体   繁体   English

使用其他查询的结果在Elasticsearch中修改相关性得分

[英]Modifying relevance score in elasticsearch using results from another query

A project I am working on utilizes elasticsearch as a search engine. 我正在研究的项目利用Elasticsearch作为搜索引擎。 I also am using a graph database to keep track of user actions and the relationships between queries, clicks, etc. 我还使用图形数据库来跟踪用户操作以及查询,点击等之间的关系。

What I want to do is index queries and their top results from the graph database into elasticsearch, so at query time, I can boost the elasticsearch _score by the score provided by the graph database. 我想要做的是将索引查询及其从图形数据库中获得的最佳结果转换为elasticsearch,因此在查询时,我可以通过图形数据库提供的分数来提高elasticsearch _score。 Is this possible in elasticsearch itself? 弹性搜索本身有可能吗? Or do I need to do the boosting externally? 还是我需要在外部进行提升?

If i understad your problem, you have your primary results comming from another source (graph DB) and that score is highly dependent of every query as it is with Elasticsearch. 如果我不太了解您的问题,那么您的主要结果来自其他来源(图形数据库),并且该分数与Elasticsearch一样,在很大程度上取决于每个查询。 Script score functions in ES are not suited for this task, as you have limited parameters to pass to it besides accessing all indexed document's fields. ES中的脚本评分功能不适合此任务,因为除了访问所有索引文档的字段之外,传递给它的参数有限。 So the only choices I can see are: 因此,我只能看到的选择是:

  1. Index the primary results including the external score and then perform a query using the above mentioned script score or simpler function score . 对包括外部得分的主要结果建立索引,然后使用上述脚本得分或更简单的功能得分执行查询。 Note that besides obvious efficiency drawbacks(indexing load on ES, roundtrips, etc), this index will contain only a subset of documents and it will highly affect the relevancy of the terms. 请注意,除了效率方面的明显缺点(ES,往返等的索引负载)之外,此索引将仅包含文档的子集,并且将极大地影响术语的相关性。
  2. Filter an ES index and combine the result externally calculating whichever new score fits you. 过滤ES索引并在外部组合结果,以计算适合您的新分数。 I would advice this one, note that if you want to get only documents found by first query you should try to filter by their ids like this or like this depending on your version, so the ES score is only made up of the terms you wanted to look for and their relevance. 我会建议这一个,请注意,如果你想获得只有第一次查询找到的文档,你应该尝试通过自己的ID,如过滤 这种或类似取决于你的版本,所以ES得分仅仅是由条款你想寻找和它们的相关性。

boost the elasticsearch _score by the score 通过分数提高elasticsearch _score

You can boost the score of the documents during elasticsearch query using the function score query . 您可以使用功能得分查询在Elasticsearch查询期间提高文档的得分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM