【问题标题】:multi_match with wildcards and boostmulti_match 与通配符和提升
【发布时间】:2019-05-14 15:32:12
【问题描述】:

我想将multi-match通配符 字段一起使用,如下所示:"fields" : [ "A*", "B*" ],。 现在,我希望任何 A 字段中的命中率都高于 B 字段中的命中率。 所以我的假设是"fields" : [ "A*^5", "B*^1" ], 应该可以工作。不是,不管5在A还是B上,结果顺序都是一样的。

哦,这是 Amazon ES (v1.5.xx)。最终我想要带有术语查询的 edgeNgram,但下面的示例使用股票短语前缀更短:

curl -XPUT 'http://localhost:9200/test123'
curl -XPUT http://localhost:9200/test123/type1/001 -d '{"A_01": "Solace"}'
curl -XPUT http://localhost:9200/test123/type1/002 -d '{"B_64": "Solitude"}'
curl -XGET 'http://localhost:9200/test123/_search?explain' -d '{
    "query" : {
    "multi_match": {
        "query" : "Sol",
        "fields" : [ "A*^5", "B*^1" ],
        "type" : "phrase_prefix"
    }
    }
}'

恐怕我一定忽略了一些东西(很简单)。任何指针都非常感谢!

参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#_literal_fields_literal_and_per_field_boosting

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    拜托,这样试试吧:

    "query":{
          "filtered":{
             "query":{
                "bool":{
                   "should":[
                      {
                         "multi_match":{
                            "query":"Sol",
                            "type":"cross_fields",
                            "fields":[
                               "A*^5","B*^20"
                            ]
                         } 
                      }
                   ]
                }
             }
          }
       }
    

    【讨论】:

    • 感谢@Luca,我将再次深入研究cross-fields,并结合edgeNgram!上面并没有真正起作用并且没有显示任何命中,因为前缀方面丢失了,只是“Sol”不在索引中。
    猜你喜欢
    • 2013-05-31
    • 1970-01-01
    • 1970-01-01
    • 2019-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多