ES与MySQL概念对比
通过概念对比,能更好的理解ES的一些概念和术语。
| MySQL | Elasticsearch |
|---|---|
| Table | Index |
| Row | Document |
| Column | Field |
| Schema | Mapping |
| SQL | DSL |
MySQL建表
CREATE TABLE `blog` (
`id` int(20) DEFAULT NULL,
`title` varchar(255) DEFAULT NULL,
`content` text,
`author` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Elasticsearch建索
ES通过调用restAPI创建索引。
curl -XPUT "http://localhost:9200/blogs" -H 'Content-Type: application/json' -d'
{
"mappings": {
"properties": {
"id": {
"type": "keyword"
},
"title": {
"type": "text"
},
"content": {
"type": "text"
},
"author": {
"type": "keyword"
},
}
}
}'
3734

被折叠的 条评论
为什么被折叠?



