美文网首页
【ES从入门到实战】十一、全文检索-ElasticSearch-

【ES从入门到实战】十一、全文检索-ElasticSearch-

作者: runewbie | 来源:发表于2020-05-25 21:25 被阅读0次

接第10节

3)、match【匹配查询】

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

match 返回 account_number=20 的数据:

GET /bank/_search
{
  "query": {
    "match": {
      "account_number": 20
    }
  }
}
在这里插入图片描述
  • 字符串,全文检索

最终查询出 address 中包含 Kings 单词的所有记录,当搜索字符串类型的时候,会进行全文检索,并且每条记录有相关性得分。

GET /bank/_search
{
  "query": {
    "match": {
      "address": "Kings"
    }
  }
}
在这里插入图片描述
  • 字符串,多个单词(分词+全文检索)

全文检索按照评分进行排序,会对检索条件进行分词匹配

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

最终查询出 address 中包含 Mill 或者 Lane 或者 Mill Lane 的所有记录,并给出相关性得分


在这里插入图片描述

参考文档-query-dsl


参考:

Elasticsearch Reference

elastic

全文搜索引擎 Elasticsearch 入门教程

相关文章

网友评论

      本文标题:【ES从入门到实战】十一、全文检索-ElasticSearch-

      本文链接:https://www.haomeiwen.com/subject/dhwuahtx.html