Elasticsearch-添加增强查询的影响

发布于 2025-01-18 18:49:33 字数 832 浏览 4 评论 0原文

我有一个下面提到的非常简单的弹性查询。

{
  "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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不气馁 2025-01-25 18:49:33

Elasticsearch添加了带有默认值的Boost参数,IMO给出不同的值对性能不会有太大影响,但是您应该能够自己测量它。

Reg。您的第二个问题,添加Boost肯定是有意义的,搜索词的出现很常见,这将有助于您找到相关文档。例如:假设您正在包含eLasticsearch帖子的索引中搜索Query(在Elasticsearch帖子上查询非常常见),但是您希望对具有TAG Elasticsearch-- 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 tag elasticsearch-query. Adding boosts in this case, will provide you more relevant results.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文