ElasticSearch在索引中的位置 [英] ElasticSearch position in index

查看:139
本文介绍了ElasticSearch在索引中的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用弹性搜索来建立一个等级。如果我按照一个分数索引排序的元素列表。我可以通过元素名称查询并获取其在索引上的位置吗?



例如,我建立一个包含两个元素的索引:



Element1,得分:8
Element2,得分:7
Element3,得分:10



查询Element2我想获得位置= 3

解决方案

Elasticsearch在实际收集结果之前不知道该地点它收集结果只能将其发送回客户端。所以,在找到你要查找的文档之前,真的没有办法得到这个地方,而没有经过结果。如果将所有这些结果发送给客户端不适合您,则可以编写一个将在服务器端执行的插件。


I'm considering the use of Elasticsearch to build a rank. If I index a list of elements that is ordered according to a score. Can I query by an element name and get its position on the Index?

e.g i build an index with two elements:

"Element1", score: 8 "Element2", score: 7 "Element3", score: 10

When I query by "Element2" I would like to obtain position = 3

解决方案

Elasticsearch doesn't know the place until it actually collects results and it collects results only to send them back to client. So, there is really no way to just get the place without going through results until you find the document you are looking for. If sending all these results to client doesn't work for you, you can write a plugin that will do it on the server side.

这篇关于ElasticSearch在索引中的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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