Elasticsearch原理及环境搭建
环境搭建
- 1.官网下载,下载对应的操作系统的版本,比如版本是7.3.0 https://www.elastic.co/cn/downloads/elasticsearch
- 2.linux或mac下进入对应解压后的目录使用bin/elasticsearch启动,window下双击bin/elasticsearch.bat的脚本启动
- 3.浏览器访问localhost:9200端口查看返回判断启动是否正常
- 4.bin/elasticsearch -d 后台启动
- 5.安装kibana,下载对应7.3.0版本的kibana(版本必须跟ES版本对应),对应配置里有链接elasticsearch的url,确认后,直接bin/kibana启动
- 6.默认访问5601端口,另外可以通过localhost:5601/status 查看对应kibana状态
- 7.选择dev tool节点后可以产生和es的交互式界面行为
名词定义
Mysql | elasticsearch |
---|---|
Database | Index |
Table | Type |
Row | Document |
Column | Filed |
Schema | Mapping |
Index | Everything is indexed |
Index | Everything is indexed |
SQL | Query DS |
SELECT * FROM table… | GET http://… |
UPDATE table SET… | PUT http://… |
- ES7之后Type被完全废弃,即只有index(索引,等同于数据库+表定义)和Document(文档,即行记录)
索引有两层含义:
- 1.搜索中的数据库或表的定义
- 2.构建文档时候的索引创建
分词:
- 1.搜索是以词为单位做最基本的搜索单元
- 2.依靠分词器构建分词
- 3.用分词构建倒排索引
ES基础语法文档
- https://www.elastic.co/guide/cn/elasticsearch/guide/current/_most_important_queries.html