如何根据索引类型在弹性搜索或lucene中提高搜索? [英] How to boost search based on index type in elasticsearch or lucene?

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

问题描述

我有三种食物类型指数意大利语,西班牙语,美式。
当用户搜索奶酪时,来自意大利语的文档似乎出现在顶部。如果我喜欢说西班牙语,是否可以提高结果? (我仍然会收到意大利语的结果,但是根据索引类型西班牙语的一些数字增值,结果中返回的文档的排序优先于西班牙语索引,这在用户输入lucene和/或ES查询?如果是,那么如何?

解决方案

添加一个带有boost类型的术语查询_type字段或_index(或两者)。


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?

解决方案

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

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

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