新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
聊聊Elastic-Search部署和應(yīng)用
es簡(jiǎn)介
Elastic官網(wǎng)
https://www.elastic.co/cn/

主要功能:
分布式搜索
數(shù)據(jù)分析
分組和聚合
es下載地址
https://www.elastic.co/cn/downloads/
linux安裝es
- 將下載的安裝包上傳導(dǎo)linux服務(wù)器,我的版本是elasticsearch-7.2.0-linux-x86_64.tar.gz
- 創(chuàng)建usr/local/soft/es目錄,將es解壓到這個(gè)目錄中
- 修改es的yum文件
node.name: node-1
// 這個(gè)很重要
http.host: 0.0.0.0
http.port: 9200
- 修改es的jvm.options
-Xms256M
-Xmx256M
- 創(chuàng)建新的用戶(hù)來(lái)啟動(dòng)es
- useradd esuser
- 賦予權(quán)限
chown -R esuser:esuser /usr/local/software/elasticsearch-7.2.0
- 切換到esuser用戶(hù)
su esuser
- 通過(guò)es用戶(hù)后臺(tái)啟動(dòng)es
sh elasticsearch -d
- 驗(yàn)證是否啟動(dòng)成功
curl -X GET "http://localhost:9200"
添加ik到es中
- 下載ik的版本必須和es版本對(duì)應(yīng)
- 將ik放到es的plugin目錄下進(jìn)行解壓
es重啟后會(huì)加載ik
es中新增索引post
curl -X PUT "localhost:9200/post"
將分詞器修改成ik
- 關(guān)閉索引
POST post/_close
- 配置ik
PUT post/_settings
{
"number_of_replicas": 0,
"index":{
"analysis.analyzer.default.type":"ik_max_word",
"analysis.search_analyzer.default.type":"ik_smart"
}
}
- 開(kāi)啟post索引
POST post/_open
創(chuàng)建es的mapping,根據(jù)自己的需求創(chuàng)建
curl --location --request PUT '787k.fun:9200/post/_mapping' \
--header 'Content-Type: application/json' \
--data-raw '{
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "text"
},
"content": {
"type": "text"
},
"blogImg": {
"type": "keyword"
},
"html_content": {
"type": "keyword"
},
"authorId": {
"type": "integer"
},
"authorName": {
"type": "keyword"
},
"tag": {
"type": "integer"
},
"type": {
"type": "integer"
},
"status": {
"type": "integer"
},
"commentCount": {
"type": "integer"
},
"score": {
"type": "double"
},
"created": {
"type": "date"
},
"updated": {
"type": "date"
}
}
}'
springboot集成es
- pom文件加入依賴(lài)
org.elasticsearch.client
elasticsearch-rest-high-level-client
7.2.0
org.elasticsearch
elasticsearch
7.2.0
- yum文件添加文件
elasticsearch.host=localhost
elasticsearch.port=9200
當(dāng)前題目:聊聊Elastic-Search部署和應(yīng)用
鏈接地址:http://www.dlmjj.cn/article/djehsei.html


咨詢(xún)
建站咨詢(xún)
