ElasticSearch配置及使用

ElasticSearch配置及使用

(参考文章:https://cloud.tencent.com/developer/article/1387196

下载及启动

ES下载地址:https://www.elastic.co/cn/downloads/elasticsearch(ES有点像Tomcat,解压后可直接使用)

进入解压目录,/bin下执行elasticsearch.bat,启动服务。访问127.0.0.1:9200,结果如下图,即启动成功!

 

基本概念

Node 与 Cluster

Elastic 本质上是一个分布式数据库,允许多台服务器协同工作,每台服务器可以运行多个 Elastic 实例。

单个 Elastic 实例称为一个节点(node)。一组节点构成一个集群(cluster)。

Index(~数据库)

Elastic 数据管理的顶层单位就叫做 Index(索引)。它是单个数据库的同义词。每个 Index (即数据库)的名字必须是小写。

Elastic 会索引所有字段,经过处理后写入一个反向索引(Inverted Index)。查找数据的时候,直接查找该索引。

查看所有Index:http://127.0.0.1:9200/_cat/indices?v

查询Index中的所有数据:http://127.0.0.1:9200/[索引名] /_search

 

Type(~表)

Document(~字段)

查看所有Index、type、document信息:http://localhost:9200/_mapping?pretty=true

对应格式:

 

基本原理

 参考:https://www.pianshen.com/article/7735306932/

posted @ 2020-08-26 10:06  =馨=星=  阅读(251)  评论(0)    收藏  举报