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

2020-05-25  本文已影响0人  runewbie

接第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 入门教程

上一篇 下一篇

猜你喜欢

热点阅读