ElasticSearch - 使用距离点影响查询相关性 [英] ElasticSearch -- use distance from point to affect query relevance

查看:157
本文介绍了ElasticSearch - 使用距离点影响查询相关性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用ElasticSearch创建一个使用距离中心点的距离来影响相关性的搜索。

Trying to use ElasticSearch to create a search that uses distance from a centerpoint to influence relevance.

我不想从一个点开始,我知道是可能的,因为我想要搜索查询的相关性也会影响结果。

I don't want to simply sort on distance from a point, which I know is possible, because I want relevance based on the searched query to also affect results.

我想传入一个搜索字符串,说咖啡 ,并且说38,-77,然后通过结合它们与咖啡的相关性以及它们与38,-77的接近程度来得到我的结果。

I'd like to pass in a search string, say "coffee", and a lat/lon, say "38, -77", and get my results ordered by a combination of how related they are to "coffee" and how close they are to "38, -77".

谢谢!

推荐答案

您可以使用 distance function .elasticsearch.org / guide / reference / query-dsl / custom-score-query.html>自定义分数查询根据距离的变化修改 _score 一个中心点

You can use distance function in the script of the Custom Score Query to modify _score based on the distance from a centerpoint.

这篇关于ElasticSearch - 使用距离点影响查询相关性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆