Elasticsearch是一种分布式、面向文档的NoSQL数据库,专门设计用于全文搜索、数据分析和日志存储。它不仅可以存储大量文档数据,还支持复杂的全文搜索、数据聚合和分析查询,使其非常适用于日志管理、搜索引擎、实时分析和大规模数据存储等场景。
Elasticsearch的数据结构由索引Index、文档Document和字段Field组成,数据结构如下所示
Index 1 (e.g., "products")
└─ Document 1 (with ID "1")
│ ├─ Field 1 (e.g., "product_name": "Laptop")
│ ├─ Field 2 (e.g., "price": 999.99)
│ └─ Field 3 (e.g., "description": "High-performance laptop")
│
└─ Document 2 (with ID "2")
├─ Field 1 (e.g., "product_name": "Smartphone")
├─ Field 2 (e.g., "price": 499.99)
└─ Field 3 (e.g., "description": "Feature-rich smartphone")
关系型数据库MySQL与ElasticSearch的结构对比

Elasticsearch 8.0.0 no longer supports mapping types.
8.0.0以后不再支持type的映射,因此我们可以简单理解:index等同于MySQL中表的概念
流程:创建index,在指定index中创建document,document则由field组成