如何在 elasticsearch 或 lucene 中基于索引类型提升搜索? [英] How to boost search based on index type in elasticsearch or lucene?

查看:25
本文介绍了如何在 elasticsearch 或 lucene 中基于索引类型提升搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个食物类型指数意大利"、西班牙"、美国".当用户搜索Cheese"时,来自Italian"的文档似乎出现在顶部.如果我倾向于说西班牙语",是否有可能提升"结果?(我仍然应该得到意大利语的结果,但是基于索引类型西班牙语"的一些数字提升值,结果中返回的文档的排序优先于西班牙语"索引.这在用户输入 lucene 和/还是 ES 查询?如果是,怎么做?

I have three food type indices "Italian", "Spanish", "American". When the user searches "Cheese", documents from "Italian" appear to come up at the top. Is it possible to "boost" the results if I were to give preference to say "Spanish"? (I should still get results for Italian, but based on some numeric boost value for index type "Spanish", the ordering of the documents returned in the results give preference to the "Spanish" index. Is this possible in user input lucene and/or ES query? If so, how?

推荐答案

_type 字段或 _index(或两者兼有).

Add a term query with a boost for either the _type field or the _index (or both).

这篇关于如何在 elasticsearch 或 lucene 中基于索引类型提升搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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