一、初始化文檔數(shù)據(jù)
-
在 Postman 中,向 ES 服務(wù)器發(fā) POST 請求 :http://localhost:9200/user/_doc/1,請求體內(nèi)容為:
{ "name":"zhangsan", "age":20, "sex":"男" }
-
在 Postman 中,向 ES 服務(wù)器發(fā) POST 請求 :http://localhost:9200/user/_doc/2,請求體內(nèi)容為:
{ "name":"zhangsan1", "age":21, "sex":"男" }
-
在 Postman 中,向 ES 服務(wù)器發(fā) POST 請求 :http://localhost:9200/user/_doc/3,請求體內(nèi)容為:
{ "name":"zhangsan2", "age":22, "sex":"男" }
-
在 Postman 中,向 ES 服務(wù)器發(fā) POST 請求 :http://localhost:9200/user/_doc/4,請求體內(nèi)容為:
{ "name":"lisi", "age":25, "sex":"女" }
二、完全匹配查詢文檔
2.1、概述
match_phrase
會將檢索關(guān)鍵詞分詞。match_phrase
的分詞結(jié)果必須在被檢索字段的分詞中都包含,默認(rèn)情況下順序必須相同且必須都是連續(xù)的。
2.2、示例
-
在 Postman 中,向 ES 服務(wù)器發(fā) POST 請求 :http://localhost:9200/user/_search,請求體內(nèi)容為:
{ "query":{ "match_phrase":{ "name":"zhangsan" } } }
文章來源:http://www.zghlxwxcb.cn/news/detail-423182.html
-
查詢成功后,服務(wù)器響應(yīng)結(jié)果
文章來源地址http://www.zghlxwxcb.cn/news/detail-423182.html
到了這里,關(guān)于Elasticsearch7.8.0版本入門—— 完全匹配查詢文檔(高級查詢)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!