国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Elasticsearch 搜索測試與集成Springboot3

這篇具有很好參考價值的文章主要介紹了Elasticsearch 搜索測試與集成Springboot3。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

Elasticsearch是專門做搜索的,它非常擅長以下方面的問題

  • Elasticsearch對模糊搜索非常擅長(搜索速度很快)
  • 從Elasticsearch搜索到的數(shù)據(jù)可以根據(jù)評分過濾掉大部分的,只要返回評分高的給用戶就好了(原生就支持排序)
  • 沒有那么準(zhǔn)確的關(guān)鍵字也能搜出相關(guān)的結(jié)果(能匹配有相關(guān)性的記錄)

它能夠一定程度上解決,在一個普通數(shù)據(jù)庫處理上億條數(shù)據(jù)時的查詢效率低下的同時無法優(yōu)秀地排列好用戶所需要的數(shù)據(jù),一次性上億條數(shù)據(jù)沒有經(jīng)過正確地排列,用戶很難找到想要的數(shù)據(jù)。并且,用戶輸入的數(shù)據(jù)可能不太準(zhǔn)確,它也能夠進(jìn)行模糊查詢,這種模糊查詢是依靠計算得來的,而不是簡單地匹配數(shù)據(jù)。本系列博文將從零開始一步步實現(xiàn)將 ES 集成到 springboot3 中,并在一個社區(qū)項目中進(jìn)行實際應(yīng)用測試,本文為系列第一篇,后續(xù),博文仍在整理,請持續(xù)關(guān)注博主,了解更多相關(guān)知識。


本文將在以下環(huán)境進(jìn)行測試:
  • window11
  • SpringBoot:3.0.2
  • Elasticsearch:8.5.0
  • elasticsearch-analysis-ik:8.5.0
  • Kibana:8.5.0

搭建 Elasticsearch 服務(wù)器以及分詞擴展

先從 Elasticsearch 官網(wǎng)下載:Elasticsearch 8.5.0 | Elastic 該版本,再去 Github 下載分詞器擴展:Release v8.5.0 · medcl/elasticsearch-analysis-ik (github.com) 下載完成之后,分別進(jìn)行解壓縮,注意后者(ik)必須解壓縮在前者(Elasticsearch)解壓后的 plugins 中的 ik 目錄下,如下:

springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

進(jìn)入 config 目錄下,我們可以看到幾個配置文件:

  • extra_main.dic:中文分詞詞典,詞語,例如:皇帝
  • extra_stopword.dic:中文停止詞詞典,結(jié)束詞:也、了
  • IKAnalyzer.cfg.xml:配置額外詞典文件

如果需要自定義詞典,在 config 目錄下自定義一個英文名稱的以 dic 結(jié)尾的文件,里面填入自定義詞,一行一個,之后從 IKAnalyzer.cfg.xml 配置自定義詞典即可生效。配置方法就是在指定位置填入對應(yīng)詞庫名稱加后綴,遠(yuǎn)程需要添加 url,并以 dic 結(jié)尾,獲取到的也必須是一行一個分詞。該 url 也需要返回兩個頭部(header),一個是Last-Modified,一個是ETag,這兩者都是字符串類型,只要有一個發(fā)生變化,該插件就會去抓取新的分詞進(jìn)而更新詞庫。遠(yuǎn)程更新不需要重啟服務(wù)器,本地詞庫文件更新需要重啟服務(wù)器。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
	<comment>IK Analyzer 擴展配置</comment>
	<!--用戶可以在這里配置自己的擴展字典 -->
	<entry key="ext_dict"></entry>
	 <!--用戶可以在這里配置自己的擴展停止詞字典-->
	<entry key="ext_stopwords"></entry>
	<!--用戶可以在這里配置遠(yuǎn)程擴展字典 -->
	<!-- <entry key="remote_ext_dict">words_location</entry> -->
	<!--用戶可以在這里配置遠(yuǎn)程擴展停止詞字典-->
	<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>

完成這些之后,我們就來配置一下 Elasticsearch 的環(huán)境變量以及本地服務(wù)器名稱、數(shù)據(jù)、日志的保存路徑。在系統(tǒng)變量處添加你解壓縮的 Elasticsearch 對應(yīng)的 bin 目錄。在 elasticsearch-8.5.0 下找到 config 中的 elasticsearch.yml 文件,這就是配置文件,需要更改的就以下三個位置:17行、33行、37行,注意把這三行前面的 “#” 去掉。

cluster.name: yumuing
path.data: C:\tool\elasticsearch-8.5.0\data
path.logs: C:\tool\elasticsearch-8.5.0\data\logs

配置完這些之后,就可以在其 bin 目錄下,找到 elasticsearch.bat 文件,雙擊啟動即可,等待出現(xiàn)如下即為啟動成功,第一次啟動較慢,耐心等待:

注意不要使用管理員權(quán)限啟動,會啟動卡住,一直不動。

springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

如果還是卡住不動,可以嘗試在 config 目錄下找到 elasticsearch.yml 增加以下代碼,關(guān)閉geoip數(shù)據(jù)庫的更新。

ingest.geoip.downloader.enabled: false

如果,自身內(nèi)存少于 16 g ,建議將 config 目錄下的 jvm.options 申請內(nèi)容配置修改為如下,注意刪除最前面的 “##”,將初始內(nèi)存改為 256m,最大內(nèi)存修改為 512m。

-Xms512m
-Xmx1g

使用第一次運行 Elasticsearch 時 會自動進(jìn)行安全配置,會在控制臺輸出賬號密碼,如下:

->  Password for the elastic user (reset with `bin/elasticsearch-reset-password -u elastic`):
  RGiwCn4abvxC4CYHNqvU

默認(rèn)賬號為:elastic

如果你忘記了賬戶密碼,可以到你上面設(shè)置的 logs 目錄尋找關(guān)鍵詞:password,如果實在找不到的話,可以在 bin 目錄下調(diào)取 cmd 命令行,輸入:elasticsearch-reset-password -u elastic ,稍等一會就會輸出密碼。如果還不能輸出密碼,可以嘗試在 elasticsearch.yml 輸入以下代碼

discovery.type: single-node

設(shè)置為單節(jié)點應(yīng)用,在嘗試輸入:elasticsearch-reset-password -u elastic 修改密碼。

默認(rèn)端口號為 9200 ,打開 cmd 命令窗口,輸入

curl -u <用戶名>:<密碼> -X GET "localhost:9200/_cat/health" 

檢查服務(wù)狀態(tài),為 green 即可開始嘗試使用了。返回的 json 如下:

{
    "cluster_name":"yumuing",
    "status":"green",
    "timed_out":false,
    "number_of_nodes":1,
    "number_of_data_nodes":1,
    "active_primary_shards":1,
    "active_shards":1,
    "relocating_shards":0,
    "initializing_shards":0,
    "unassigned_shards":0,
    "delayed_unassigned_shards":0,
    "number_of_pending_tasks":0,
    "number_of_in_flight_fetch":0,
    "task_max_waiting_in_queue_millis":0,
    "active_shards_percent_as_number":100
}

當(dāng)然,在控制臺中沒有進(jìn)行格式美化,是一長串,注意一下。

如果不想要安全認(rèn)證的話,可以添加以下代碼到 elasticsearch.yml 中

xpack.security.enabled: false

輸入:

curl -X GET "localhost:9200/_cat/health" 

即可得到健康狀態(tài)。

常見 http 命令

索引在 MySql 中代表數(shù)據(jù)庫,文檔代表一行數(shù)據(jù),字段代表一列數(shù)據(jù)。

添加索引:put 請求

localhost:9200/test

查詢索引:get 請求

localhost:9200/_cat/indices

刪除索引:delete 請求

localhost:9200/test

插入文檔:put 請求,也可作為更新數(shù)據(jù),如有相同值文檔,會先刪除再增加,變相地更新

localhost:9200/test/_doc/{id}

并提交對應(yīng)的 json 數(shù)據(jù),如下:

springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

獲得回復(fù):本次請求中 id 值設(shè)為 1,類型在版本8.5.0已被舍棄,故沒有 _type 字段。但 _doc 還是得保留在請求中?!皉esult”: “created”,

{
    "_index": "test",
    "_id": "1",
    "_version": 1,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 0,
    "_primary_term": 1
}

更新文檔的回復(fù):“result”: “updated”,

{
    "_index": "test",
    "_id": "1",
    "_version": 2,
    "result": "updated",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 3,
    "_primary_term": 1
}

查詢文檔:get請求, _source 即為文檔數(shù)據(jù)

localhost:9200/test/_doc/{id}
{
    "_index": "test",
    "_id": "1",
    "_version": 1,
    "_seq_no": 0,
    "_primary_term": 1,
    "found": true,
    "_source": {
        "name": "yumuing",
        "content": "hello"
    }
}

或者查詢不到數(shù)據(jù): “found”: false

{
    "_index": "test",
    "_id": "1",
    "found": false
}

刪除文檔:delete 請求

localhost:9200/test/_doc/{id}

返回數(shù)據(jù):“result”: “deleted”

{
    "_index": "test",
    "_id": "1",
    "_version": 2,
    "result": "deleted",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 1,
    "_primary_term": 1
}

搜索所有數(shù)據(jù):get請求 “hits”: 為所有數(shù)據(jù), “value”: 3:搜索到多少條數(shù)據(jù)

localhost:9200/{索引}/_search

回復(fù):

{
    "took": 809,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 3,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [
            {
                "_index": "test",
                "_id": "1",
                "_score": 1.0,
                "_source": {
                    "title": "test",
                    "content": "測試一下"
                }
            },
            {
                "_index": "test",
                "_id": "3",
                "_score": 1.0,
                "_source": {
                    "title": "test",
                    "content": "測試2"
                }
            },
            {
                "_index": "test",
                "_id": "2",
                "_score": 1.0,
                "_source": {
                    "title": "test",
                    "content": "測試3"
                }
            }
        ]
    }
}

搜索單一特定內(nèi)容:get 請求,內(nèi)容無需雙引號,搜索時,會自動提取內(nèi)容中的詞組再分別搜索包含對應(yīng)詞組的文檔,多少個詞組就有多少個搜索條件。就像運營實習(xí),會被分為三個詞組去搜索,一個是運營實習(xí),一個是運營,一個是實習(xí)。

localhost:9200/{索引}/_search?q=字段名:內(nèi)容

返回數(shù)據(jù)與搜索全部數(shù)據(jù)類似,就不展示了。

搜索多個字段內(nèi)容:get 請求,攜帶 json

“query”:“搜索關(guān)鍵詞”
“fields”:[“字段1”,“字段2”]

{
    "query":{
        "multi_match":{
            "query":"2",
            "fields":["title","content"]
        }
    }
}

返回數(shù)據(jù)與其他搜索數(shù)據(jù)類似不展示。

當(dāng)然,es 的搜索語法并不只有這些,還有很多,建議查看官方文檔,本文僅對 es 做簡單介紹,下文將介紹如何集成進(jìn) springboot中,并進(jìn)行實際應(yīng)用。

springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

圖形化界面

一、Kibana是什么

Kibana 是為 Elasticsearch設(shè)計的開源分析和可視化平臺。你可以使用 Kibana 來搜索,查看存儲在 Elasticsearch 索引中的數(shù)據(jù)并與之交互。你可以很容易實現(xiàn)高級的數(shù)據(jù)分析和可視化,以圖表的形式展現(xiàn)出來。
使用前我們肯定需要先有Elasticsearch啦,安裝使用Elasticsearch可以參考Elasticsearch構(gòu)建全文搜索系統(tǒng)

下面分別演示一下Kibana的安裝、自定義索引,搜索,控制臺調(diào)用es的api和可視化等操作,特別需要注意的是,控制臺可以非常方便的來調(diào)用es的api,強烈推薦使用

二、如何安裝

直接下載對應(yīng)平臺的版本就可以,參考地址Installing Kibana
這里我直接下載了 windows 平臺的 Kibana 8.5.0 | Elastic

配置可以參考Configring Kibana
設(shè)置監(jiān)聽端口號、es地址、索引名
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

默認(rèn)情況下,kibana啟動時將生成隨機密鑰,這可能導(dǎo)致重新啟動后失敗,需要配置多個實例中有相同的密鑰
設(shè)置

xpack.reporting.encryptionKey: "chenqionghe"
xpack.security.encryptionKey: "122333444455555666666777777788888888"
xpack.encryptedSavedObjects.encryptionKey: "122333444455555666666777777788888888"

啟動

./bin/kibana

打開http://localhost:5601,畫風(fēng)如下
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

提示我們可以使用示例數(shù)據(jù),也可以使用自己已有的數(shù)據(jù),我把示例數(shù)據(jù)都下載了,單擊側(cè)面導(dǎo)航中的 Discover 進(jìn)入 Kibana 的數(shù)據(jù)探索功能:
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

可以看到數(shù)據(jù)已經(jīng)導(dǎo)入了,我們可以直接使用查詢欄編寫語句查詢
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

三、如何加載自定義索引

接下來演示加載已經(jīng)創(chuàng)建book索引
單擊 Management 選項
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

然后單擊 Index Patterns 選項。
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

點擊Create index pattern定義一個新的索引模式。
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

點擊Next step
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

點擊Create index pattern
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

出來如下界面,列出了所有index中的字段
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

接下來,我們再來使用一下kibana查看已經(jīng)導(dǎo)入的索引數(shù)據(jù)
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

可以看到,已經(jīng)能展示和檢索出我們之前導(dǎo)入的數(shù)據(jù),奧利給!

四、如何搜索數(shù)據(jù)

springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

可以看到,我們能很方便地搜索欄使用Llucene查詢,查詢語法可以參考Lucene查詢語法匯總

五、如何切換中文

config/kibana.yml添加

i18n.locale: "zh-CN"

重新啟動,即可生效
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

六、如何使用控制臺

控制臺插件提供一個用戶界面來和 Elasticsearch 的 REST API 交互。控制臺有兩個主要部分: editor ,用來編寫提交給 Elasticsearch 的請求; response 面板,用來展示請求結(jié)果的響應(yīng)。在頁面頂部的文本框中輸入 Elasticsearch 服務(wù)器的地址。默認(rèn)地址是:“l(fā)ocalhost:9200”。
點擊左側(cè)欄的[Dev Tools],可以看到如下界面,可以很方便地執(zhí)行命令
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

示例操作

# 查看所有節(jié)點
GET _cat/nodes

# 查看book索引數(shù)據(jù)
GET book/_search
{
    "query": {
    "match": {
      "content": "chenqionghe"
    }
  }
}

# 添加一條數(shù)據(jù)
POST book/_doc 
{
  "page":8,
  "content": "chenqionghe喜歡運動,繩命是如此的精彩,繩命是多么的輝煌"
}

# 更新數(shù)據(jù)
PUT book/_doc/iSAz4XABrERdg9Ao0QZI
{
  "page":8,
  "content":"chenqionghe喜歡運動,繩命是剁么的回晃;繩命是入刺的井猜"
}

# 刪除數(shù)據(jù)
POST book/_delete_by_query
{
  "query": {
    "match": {
      "page": 8
    }
  }
}

# 批量插入數(shù)據(jù)
POST book/_bulk
{ "index":{} }
{ "page":22 , "content": "Adversity, steeling will strengthen body.逆境磨練意志,鍛煉增強體魄。"}
{ "index":{} }
{ "page":23 , "content": "Reading is to the mind, such as exercise is to the body.讀書之于頭腦,好比運動之于身體。"}
{ "index":{} }
{ "page":24 , "content": "Years make you old, anti-aging.歲月催人老,運動抗衰老。"}
{ "index":{} }

springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

七、如何使用可視化

Kibana可視化控件基于 Elasticsearch 的查詢。利用一系列的 Elasticsearch 查詢聚合功能來提取和處理數(shù)據(jù),再通過創(chuàng)建圖表來呈現(xiàn)數(shù)據(jù)分布和趨勢

點擊Visualize菜單,進(jìn)入可視化圖表創(chuàng)建界面,Kibana自帶有上10種圖表,我們來創(chuàng)建一個自己的圖表
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

我們來添加一個直方圖
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

可以看到,默認(rèn)已經(jīng)有一個Y軸了,統(tǒng)計的是數(shù)量,我們添加一個X軸,點擊Buckets下的Add
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

如下,我選擇了customer_id字段作為x軸
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

執(zhí)行后如下
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

保存一下
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

八、如何使用儀表盤

Kibana 儀表板(Dashboard) 展示保存的可視化結(jié)果集合。
就是可以把上面定義好的圖表展示
創(chuàng)建一個Dashboard
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

添加已經(jīng)存在的圖表
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

添加完后保存即可,我們可以定制出非常豐富的面板,如下
springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot

Kibana的使用就是這么簡單,是不是覺得超簡單,建議自己去安裝使用一下,加深印象。

springboot3 elasticsearch,后端開發(fā),elasticsearch,搜索引擎,springboot文章來源地址http://www.zghlxwxcb.cn/news/detail-814898.html

到了這里,關(guān)于Elasticsearch 搜索測試與集成Springboot3的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • SpringBoot集成Solr(二)搜索數(shù)據(jù)

    SpringBoot集成Solr(二)搜索數(shù)據(jù)

    1.1 構(gòu)建查詢條件 上面代碼中左邊的字符串是映射到solr中的實體屬性,相當(dāng)于數(shù)據(jù)庫中的表字段, * 表示匹配多位。 1.2 構(gòu)建排序條件 1.3 設(shè)置分頁 注意: solr的分頁第一頁其實是從0開始的,部分框架中分頁插件第一頁是從1開始的 。 1.4 設(shè)置高亮 注意: 這種方式設(shè)置的高亮

    2024年02月12日
    瀏覽(20)
  • 【SpringBoot】SpringBoot集成ElasticSearch

    【SpringBoot】SpringBoot集成ElasticSearch

    這段代碼是一個基本的 Elasticsearch Java 客戶端的配置類,用于創(chuàng)建一個 RestHighLevelClient 實例。 其中 RestHighLevelClient 是 Elasticsearch Java 客戶端的高級別別名,是基于 LowLevelClient 之上的封裝,提供了一些更加方便的方法和功能。 在這段代碼中,使用了 @Value 注解來注入三個配置項

    2024年02月04日
    瀏覽(23)
  • Elasticsearch 集成---框架集成SpringData-集成測試-索引操作

    Elasticsearch 集成---框架集成SpringData-集成測試-索引操作

    1.Spring Data 框架介紹 Spring Data 是一個用于簡化數(shù)據(jù)庫、非關(guān)系型數(shù)據(jù)庫、索引庫訪問,并支持云服務(wù)的 開源框架。其主要目標(biāo)是使得對數(shù)據(jù)的訪問變得方便快捷,并支持 map-reduce 框架和云計 算數(shù)據(jù)服務(wù)。 Spring Data 可以極大的簡化 JPA ( Elasticsearch ?)的寫法,可以在幾乎不

    2024年02月11日
    瀏覽(25)
  • SpringBoot集成 ElasticSearch

    SpringBoot集成 ElasticSearch

    對于ElasticSearch比較陌生的小伙伴可以先看看ElasticSearch的概述ElasticSearch安裝、啟動、操作及概念簡介 好的開始啦~ 1.1、導(dǎo)入依賴 新版本配置方式(推薦使用) 新的配置方式使用的是 High Level REST Client 的方式來替代之前的 Transport Client 方式,使用的是 HTTP 請求,和 Kibana 一樣使

    2023年04月20日
    瀏覽(23)
  • SpringBoot集成ElasticSearch

    SpringBoot集成ElasticSearch

    實現(xiàn)搜索并高亮 在線體驗:http://www.sixkey-world.top

    2024年03月17日
    瀏覽(29)
  • SpringBoot 集成 Elasticsearch

    SpringBoot 集成 Elasticsearch

    版本說明詳見 Elasticsearch 下載 kibana下載 ik分詞器下載 2.1 解壓,在elasticsearch-7.8.0plugins 路徑下新建ik目錄 2.2 將ik分詞器解壓放入ik目錄 2.3 擴展詞匯測試示例 2.3.1 ik/config 目錄下新建custom.dic文件 2.3.2 編輯custom.dic文件,加入新詞匯 注意:custom.dic文件內(nèi)容的格式的編碼為UTF-8格

    2024年02月14日
    瀏覽(23)
  • ElasticSearch集成SpringBoot實踐

    ElasticSearch集成SpringBoot實踐

    Search API Search Request,用于搜索文檔,聚合,相關(guān)的任何操作,還提供了高亮顯示結(jié)果文檔的方法 使用SearchSourceBuilder,大多數(shù)控制搜索行為的選項都可以在SearchSourceBuilder上設(shè)置 構(gòu)建查詢,搜索查詢是使用QueryBuilder對象創(chuàng)建的,ES的查詢DSL支持的每一種搜索查詢類型都有一個

    2024年02月03日
    瀏覽(18)
  • 六、SpringBoot集成elasticsearch

    目錄 官網(wǎng)API介紹 1、新建maven項目 2、檢查elasticsearch依賴的版本 3、配置RestHighLevelClient對象 4、使用springboot-test測試API的使用 Java API Client https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/index.html Java REST Client(rest-high-level-client): https://www.elastic.co/guide/en/elasticsearc

    2024年02月09日
    瀏覽(22)
  • SpringBoot Elasticsearch全文搜索

    SpringBoot Elasticsearch全文搜索

    全文搜索(檢索),工作原理:計算機索引程序,掃描文章中的每一個詞,對每一個詞建立一個索引,指明出現(xiàn)次數(shù)和位置。查詢時通過索引進(jìn)行查找,類似于查字典。 因為是通過索引在查,速度較于通過sql查,會快很多。 具體過程如下: 1、建文本庫 2、建立索引 3、執(zhí)行

    2024年02月03日
    瀏覽(20)
  • 【極光系列】springBoot集成elasticsearch

    【極光系列】springBoot集成elasticsearch

    直接下載解壓可用 https://gitee.com/shawsongyue/aurora.git 模塊:aurora_elasticsearch tips:注意es客戶端版本要與java依賴版本一致,目前使用7.6.2版本 elasticsearch 7.6.2版本客戶端下載: https://www.elastic.co/cn/downloads/elasticsearch 1.下載對應(yīng)版本資源包 登錄頁面–》View path releases–》選擇7.6.2版本

    2024年01月25日
    瀏覽(21)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包