Elasticsearch-添加增强查询的影响
我有一个下面提到的非常简单的弹性查询。
{
"query": {
"bool": {
"must": [
{
"bool": {
"minimum_should_match": 1,
"should": [
{
"match": {
"tag": {
"query": "Audience: PRO Brand: Samsung",
"boost": 3,
"operator": "and"
}
}
},
{
"match": {
"tag": {
"query": "audience: PRO brand samsung",
"boost": 2,
"operator": "or"
}
}
}
]
}
}
]
}
}
}
我想知道如果我在查询中添加提升,是否会因此而产生任何性能影响,并且如果您有一个非常大的数据集,其中搜索词的出现很常见,那么提升也会有所帮助。
I have a very simple Elastic query mentioned below.
{
"query": {
"bool": {
"must": [
{
"bool": {
"minimum_should_match": 1,
"should": [
{
"match": {
"tag": {
"query": "Audience: PRO Brand: Samsung",
"boost": 3,
"operator": "and"
}
}
},
{
"match": {
"tag": {
"query": "audience: PRO brand samsung",
"boost": 2,
"operator": "or"
}
}
}
]
}
}
]
}
}
}
I want to know if I add a boost in the query, will there be any performance impact because of this, and also will boosting help if you have a very large data set, where the occurrence of a search word is common.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Elasticsearch添加了带有默认值的Boost参数,IMO给出不同的值对性能不会有太大影响,但是您应该能够自己测量它。
Reg。您的第二个问题,添加Boost肯定是有意义的,搜索词的出现很常见,这将有助于您找到相关文档。例如:假设您正在包含eLasticsearch帖子的索引中搜索
Query
(在Elasticsearch帖子上查询非常常见),但是您希望对具有TAGElasticsearch-- Elasticsearch-查询
。在这种情况下,添加提升将为您提供更多相关的结果。Elasticsearch adds boost param with default value, IMO giving different value won't make much difference in the performance, but you should be able to measure it yourself.
Reg. your second question, adding boost definitely makes sense where the occurrence of your search words are common, this will help you to find the relevant document. for example: suppose you are searching for
query
in a index containing Elasticsearch posts(query will be very common on Elasticsearch posts), but you want the give more weight to documents which have tagelasticsearch-query
. Adding boosts in this case, will provide you more relevant results.