gpt4 book ai didi

ElasticSearch bool should_not 过滤器

转载 作者:行者123 更新时间:2023-11-29 02:50:44 27 4
gpt4 key购买 nike

我是elasticsearch的新手,所以我的问题是:

boolean 过滤器中有 3 个部分:

must    All of these clauses must match. The equivalent of AND. must_not    All of these clauses must not match. The equivalent of NOT. should    At least one of these clauses must match. The equivalent of OR. 

如何执行“should_not”查询?

提前致谢:)

最佳答案

为了获得类似“should_not”的信息,请尝试以下查询:

GET /bank/account/_search{   "size": 2000,   "query": {      "bool": {          "must": {             "match_all": {}          },          "should": {            "bool": {               "must_not": {                  "match": {                     "city": "XYZ"                  }               }            }         }      }   }}

在这种情况下,需要使用子句“must”来检索所有结果(城市“XYZ”的结果也是如此),但该特定结果的分数会降低。

关于ElasticSearch bool should_not 过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35061299/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com