ES与MySQL概念对比

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"
      },
    }
  }
}'
发布了933 篇原创文章 · 获赞 388 · 访问量 281万+

猜你喜欢

转载自blog.csdn.net/kingmax54212008/article/details/104203956