ES是什么
- 搜索引擎 search engine
- 近实时 (Near) Real Time Search
- RESTful API
- 分布式、高可用
- 面向文档存储,json格式
- 基于Apache Lucene
核心概念
- Cluster 集群
- Node 构成集群的单机节点
- Index 索引
- Shard 分片
- Replica 副本
- Segment 分段
- Document 文档
- Field 字段
- Inverted Index 倒排索引
- Text / Keyword 类型
使用全流程
schema(mapping)
es不需要前置的schema定义,在索引doc时确定schema
因为es数据的交互形式是json,所以doc可以开箱即用,在写入doc时如果没有预先定义的mapping,doc的每一个field会根据传过来的json数据确定类型,默认规则(dynamic field mapping)如下:
json类型 |
es类型 |
null |
不会增加field |
boolean |
boolean |
string |
date(通过Date detection)double/long(通过Numeric detection)text(带keyword的sub field |