日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

第50节:初识搜索引擎_上机动手实战多搜索条件组合查询

發布時間:2024/1/8 55 豆豆
生活随笔 收集整理的這篇文章主要介紹了 第50节:初识搜索引擎_上机动手实战多搜索条件组合查询 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

課程大綱

?

GET /website/article/_search

{

? "query": {

??? "bool": {

????? "must": [

??????? {

????????? "match": {

??????????? "title": "elasticsearch"

????????? }

??????? }

????? ],

????? "should": [

??????? {

????????? "match": {

??????????? "content": "elasticsearch"

????????? }

??????? }

????? ],

????? "must_not": [

??????? {

????????? "match": {

??????????? "author_id": 111

????????? }

??????? }

????? ]

??? }

? }

}

?

{

??? "bool": {

??????? "must":???? { "match": { "title": "how to make millions" }},

??????? "must_not": { "match": { "tag":?? "spam" }},

??????? "should": [

??????????? { "match": { "tag": "starred" }}

??????? ],

??????? "filter": {

????????? "range": { "date": { "gte": "2014-01-01" }}

??????? }

??? }

}

?

bool

must,must_not,should,filter

?

每個子查詢都會計算一個document針對它的相關度分數,然后bool綜合所有分數,合并為一個分數,當然filter是不會計算分數的

?

{

??? "bool": {

??????? "must":???? { "match": { "title": "how to make millions" }},

??????? "must_not": { "match": { "tag":?? "spam" }},

??????? "should": [

??????????? { "match": { "tag": "starred" }}

??????? ],

??????? "filter": {

????????? "bool": {

????????????? "must": [

????????????? ????{ "range": { "date": { "gte": "2014-01-01" }}},

????????????????? { "range": { "price": { "lte": 29.99 }}}

????????????? ],

????????????? "must_not": [

????????????????? { "term": { "category": "ebooks" }}

????????????? ]

????????? }

??????? }

??? }

}

?

GET /company/employee/_search

{//注意單純的filter ,必須添加constant_score

? "query": {

??? "constant_score": {

????? "filter": {

??????? "range": {

????????? "age": {

??????????? "gte": 30

????????? }

??????? }

????? }

??? }

? }

}

?

?

總結

以上是生活随笔為你收集整理的第50节:初识搜索引擎_上机动手实战多搜索条件组合查询的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。