聊聊 Elastic-Search 部署和应用

es简介

Elasticsearch 是聊聊一个分布式可扩展的实时搜索和分析引擎,一个建立在全文搜索引擎 Apache Lucene(TM) 基础上的搜索引擎

Elastic官网

https://www.elastic.co/cn/

主要功能:

分布式搜索

数据分析

分组和聚合

es下载地址

https://www.elastic.co/cn/downloads/

linux安装es

将下载的安装包上传导linux服务器,我的版本是香港云服务器elasticsearch-7.2.0-linux-x86_64.tar.gz创建usr/local/soft/es目录,将es解压到这个目录中修改es的yum文件node.name: node-1

// 这个很重要

http.host: 0.0.0.0

http.port: 9200修改es的jvm.options-Xms256M

-Xmx256M创建新的用户来启动esuseradd esuser赋予权限chown -R esuser:esuser /usr/local/software/elasticsearch-7.2.0切换到esuser用户su esuser通过es用户后台启动essh elasticsearch -d验证是否启动成功curl -X GET "http://localhost:9200"

添加ik到es中

下载ik的云服务器版本必须和es版本对应将ik放到es的plugin目录下进行解压

es重启后会加载ik

es中新增索引post

curl -X PUT "localhost:9200/post"

将分词器修改成ik

关闭索引POST post/_close配置ikPUT post/_settings

{

"number_of_replicas": 0,

"index":{

"analysis.analyzer.default.type":"ik_max_word",

"analysis.search_analyzer.default.type":"ik_smart"

}

}开启post索引POST post/_open

创建es的mapping,根据自己的需求创建

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文件加入依赖

org.elasticsearch.client

elasticsearch-rest-high-level-client

7.2.0

org.elasticsearch

elasticsearch

7.2.0

yum文件添加文件elasticsearch.host=localhost

elasticsearch.port=9200
数据库
上一篇:打开https://www.aizhan.com/输入自己想要查询的域名然后按回车键,如果做过网站都会有数据显示出来
下一篇:第六:这个圈子里的域名确实是赚钱的一些大玩家,至于小米农,有多少赚钱?几乎没有,也就是说,轿子里只有一个人,而且大多数人都抬着轿子。