es like模糊匹配_ES系列九之常用查询api

本文详细介绍了Elasticsearch中各种模糊查询API的用法,包括term查询、match查询、query_string查询和布尔查询等,涵盖从基本概念到复杂组合查询的多种场景,适合Elasticsearch使用者参考。
摘要由CSDN通过智能技术生成

b46bda4491236061acc8fc19d3e75335.png

一、term查询

{     "query": {
            "term": {
                "title": "hello"        }    }}

  1.1、指定权重

{     "query": {
            "term": {
                "title": {
                    "value":"hello",                "boost":10.0             }        }    }}

1.2.多term查询查询tags字段中包含novel或book

{     "query": {
            "terms": {
                "tags": ["novel","book"]        }    }}

二、常用词查询

2.1、cutoff_frequency查询低于这个概率的词

{     "query": {
            "common": {
                 "title":{
                     "query":"hello and hello",                 "cutoff_frequency":0.001             }        }    }}

2.2、match查询( 不支持lucene查询语法,分词后再查询 )

查询title包含hello或and或like的文档

{     "query": {
            "match": {
                "title": "hello and like"        }    }}

2.3、operator操作符

要求and或者or匹配文本的分词

{     "query": {
            "match": {
                "title": {
                     "query":"hello and like",                 "operator":"and"            }        }    }}

2.4、短语查询

{     "query": {
            "match_phrase": {
                "title": {
                     "query":"hello and like",                 "slop":1            }        }    }}

2.5、前缀查询

对查询关键词的最后一个词条做前缀匹配

{     "query": {
            "match_phrase_prefix": {
                "title": {<
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值