ES进阶(2)-match&match_phrase&multi_match

1.match【匹配查询】

1.1.基本类型(非字符串),精确匹配

GET bank/_search
{
  "query": {
    "match": {
      "account_number" : 20
    }
  }
}

在这里插入图片描述

1.2.字符串,全文检索

GET bank/_search
{
  "query": {
    "match": {
      "address" : "Kings"
    }
  }
}

在这里插入图片描述

1.3多个字符串(分词+全文检索)

GET bank/_search
{
  "query": {
    "match": {
      "address" : "Mill lane"
    }
  }
}

查询出 address 中包含 mill 或者 lane或者 mill lane的所有记录,并给出相关性得分
在这里插入图片描述

2.match_phrase【短语匹配】

将需要匹配的值当成==一个整体单词(不分词)==进行检索

GET bank/_search
{
  "query": {
    "match_phrase": {
      "address" : "Mill lane"
    }
  }
}

在这里插入图片描述

3.multi_match【多字段匹配】

address或者city包含mill中包含mill或Movico(或mill Movico,卽会分词)即可

GET bank/_search
{
  "query": {
    "multi_match": {
      "query": "mill Movico", 
     "fields":["address","city"]
    }
  }
}

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值