带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(7)

本文涉及的产品
检索分析服务 Elasticsearch 版,2核4GB开发者规格 1个月
简介: 带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(7)

《Elastic Stack 实战手册》——三、产品能力——3.4.入门篇——3.4.2.Elasticsearch基础应用——3.4.2.3.Search通过Kibana(6) https://developer.aliyun.com/article/1231065


以上查询表示 brandName 包含“东” 和 “果” 至少匹配成功一次,查询结果如下:


"hits" : [
      {
        "_index" : "my_goods",
        "_type" : "_doc",
        "_id" : "4",
        "_score" : 1.5678144,
        "_source" : {
          "shopCode" : "sc00001",
          "brandName" : "山东苹果",
          "closeUserCode" : [
            "uc001",
            "uc002",
            "uc003"
          ],
          "skuCode_brandName" : "skuCode4山东苹果",
          "channelType" : "cloudPlatform",
          "publicPrice" : 16977.76,
          "goodsName_length" : 31,
          "groupPrice" : [
            {
              "level" : "level1",
              "boxLevelPrice" : "2488.88"
            },
            {
              "level" : "level2",
              "boxLevelPrice" : "3488.88"
            }
          ],
          "boxPrice" : [
            {
              "boxType" : "box1",
              "boxUserCode" : [
                "uc004",
                "uc005",
                "uc006",
                "uc001"
              ],
              "boxPriceDetail" : 4488.88
            },
            {
              "boxType" : "box2",
              "boxUserCode" : [
                "htd007",
                "htd008",
                "htd009",
                "uc0010"
              ],
              "boxPriceDetail" : 5488.88
            }
          ],
          "boostValue" : 1.2,
          "goodsName" : "山东苹果UA55RU7520JXXZ 苹果54英寸 5K超高清",
          "skuCode" : "skuCode4"
        }
      },
      {
        "_index" : "my_goods",
        "_type" : "_doc",
        "_id" : "2",
        "_score" : 0.2792403,
        "_source" : {
          "shopCode" : "sc00002",
          "brandName" : "苹果",
          "closeUserCode" : [
            "0"
          ],
          "skuCode_brandName" : "skuCode2苹果",
          "channelType" : "cloudPlatform",
          "publicPrice" : 12377.76,
          "goodsName_length" : 13,
          "groupPrice" : null,
          "boxPrice" : null,
          "boostValue" : 1.0,
          "goodsName" : "苹果 55英寸 3K超高清",
          "skuCode" : "skuCode2"
        }
      },
      {
        "_index" : "my_goods",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 0.2792403,
        "_source" : {
          "shopCode" : "sc00001",
          "brandName" : "苹果",
          "closeUserCode" : [
            "0"
          ],
          "skuCode_brandName" : "skuCode1苹果",
          "channelType" : "cloudPlatform",
          "publicPrice" : 32755.52,
          "goodsName_length" : 13,
          "groupPrice" : null,
          "boxPrice" : null,
          "boostValue" : 1.8,
          "goodsName" : "苹果 51英寸 4K超高清",
          "skuCode" : "skuCode1"
        }
      },
      {
        "_index" : "my_goods",
        "_type" : "_doc",
        "_id" : "3",
        "_score" : 0.21222264,
        "_source" : {
          "shopCode" : "sc00001",
          "brandName" : "美国苹果",
          "closeUserCode" : [
            "0"
          ],
          "skuCode_brandName" : "skuCode3美国苹果",
          "channelType" : "cloudPlatform",
          "publicPrice" : 16777.76,
          "goodsName_length" : 26,
          "groupPrice" : null,
          "boxPrice" : [
            {
              "boxType" : "box1",
              "boxUserCode" : [
                "htd003",
                "uc004"
              ],
              "boxPriceDetail" : 4388.88
            },
            {
              "boxType" : "box2",
              "boxUserCode" : [
                "uc005",
                "uc0010"
              ],
              "boxPriceDetail" : 5388.88
            }
          ],
          "boostValue" : 1.2,
          "goodsName" : "苹果UA55RU7520JXXZ 53英寸 4K高清",
          "skuCode" : "skuCode3"
        }
      },
  ...
]

当我们调整 minimum_should_match 为 2 时观察结果返回:


POST /my_goods/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "term": {
            "brandName": {
              "value": "东"
    320         >   三、产品能力
            }
          }
        },
        {
          "term": {
            "brandName": {
              "value": "果"
            }
          }
        }
      ],
      "minimum_should_match" : 2
    }
  }
}
#返回:
"hits" : [
      {
        "_index" : "my_goods",
        "_type" : "_doc",
        "_id" : "4",
        "_score" : 1.5678144,
        "_source" : {
          "shopCode" : "sc00001",
          "brandName" : "山东苹果",
          "closeUserCode" : [
            "uc001",
            "uc002",
            "uc003"
          ],
          "skuCode_brandName" : "skuCode4山东苹果",
          "channelType" : "cloudPlatform",
          "publicPrice" : 16977.76,
          "goodsName_length" : 31,
          "groupPrice" : [
            {
              "level" : "level1",
              "boxLevelPrice" : "2488.88"
            },
            {
              "level" : "level2",
              "boxLevelPrice" : "3488.88"
            }
          ],
          "boxPrice" : [
            {
              "boxType" : "box1",
              "boxUserCode" : [
                "uc004",
                "uc005",
                "uc006",
                "uc001"
              ],
              "boxPriceDetail" : 4488.88
            },
            {
              "boxType" : "box2",
              "boxUserCode" : [
                "htd007",
                "htd008",
                "htd009",
                "uc0010"
              ],
              "boxPriceDetail" : 5488.88
            }
          ],
          "boostValue" : 1.2,
          "goodsName" : "山东苹果UA55RU7520JXXZ 苹果54英寸 5K超高清",
          "skuCode" : "skuCode4"
        }
      }
    ]


可以看到,只有 goodsName 出现 “东” 和 “果” 2 次以及 2 次以上的结果被查询到。

 《Elastic Stack 实战手册》——三、产品能力——3.4.入门篇——3.4.2.Elasticsearch基础应用——3.4.2.3.Search通过Kibana(8) https://developer.aliyun.com/article/1231063

相关实践学习
使用阿里云Elasticsearch体验信息检索加速
通过创建登录阿里云Elasticsearch集群,使用DataWorks将MySQL数据同步至Elasticsearch,体验多条件检索效果,简单展示数据同步和信息检索加速的过程和操作。
ElasticSearch 入门精讲
ElasticSearch是一个开源的、基于Lucene的、分布式、高扩展、高实时的搜索与数据分析引擎。根据DB-Engines的排名显示,Elasticsearch是最受欢迎的企业搜索引擎,其次是Apache Solr(也是基于Lucene)。 ElasticSearch的实现原理主要分为以下几个步骤: 用户将数据提交到Elastic Search 数据库中 通过分词控制器去将对应的语句分词,将其权重和分词结果一并存入数据 当用户搜索数据时候,再根据权重将结果排名、打分 将返回结果呈现给用户 Elasticsearch可以用于搜索各种文档。它提供可扩展的搜索,具有接近实时的搜索,并支持多租户。
相关文章
|
12月前
|
API 索引
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(3)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(3)
|
12月前
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(8)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(8)
|
12月前
|
存储 索引
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(1)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(1)
|
12月前
|
自然语言处理
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(13)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(13)
|
12月前
|
自然语言处理 索引
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(12)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(12)
|
12月前
|
缓存 数据库 索引
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(6)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(6)
|
12月前
|
索引
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(15)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(15)
|
12月前
|
索引
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(4)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(4)
|
12月前
|
缓存
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(10)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(10)
|
12月前
|
定位技术
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(19)
带你读《Elastic Stack 实战手册》之18:——3.4.2.3.Search通过Kibana(19)

相关课程

更多