Elasticsearch:入门采坑笔记-----索引篇

1. 创建索引

前面已经搭建好基本的ES集群环境,然后按教程创建索引和映射时出现此问题。
Elasticsearch:入门采坑笔记-----索引篇_第1张图片

{
    "error": {
        "root_cause": [
            {
                "type": "mapper_parsing_exception",
                "reason": "Root mapping definition has unsupported parameters:  [models : {properties={gmt_create={type=date}, device_pid={type=text}, device_time={type=date}}}]"
            }
        ],
        "type": "mapper_parsing_exception",
        "reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [models : {properties={gmt_create={type=date}, device_pid={type=text}, device_time={type=date}}}]",
        "caused_by": {
            "type": "mapper_parsing_exception",
            "reason": "Root mapping definition has unsupported parameters:  [models : {properties={gmt_create={type=date}, device_pid={type=text}, device_time={type=date}}}]"
        }
    },
    "status": 400
}

检查请求参数JSON,类比网上的例子,删掉models节点,如下:

{
    "mappings":{
            "properties":{
                "device_pid":{
                   "type":"text"
                },
                "gmt_create":{
                   "type":"date"
                },
                "device_time":{
                   "type":"date"
                }
            }
    }
}

创建一个名为test的索引,该索引有3个映射字段:device_pid、gmt_create、device_time。
Elasticsearch:入门采坑笔记-----索引篇_第2张图片
通过es-head插件查看
Elasticsearch:入门采坑笔记-----索引篇_第3张图片
test索引确实已经创建成功,因为我们没有设置分片和副本,因此有1个分片,和1个副本,边框加粗的为主节点,不加粗的为副本节点。

2. 查看索引

Elasticsearch:入门采坑笔记-----索引篇_第4张图片

3. 修改索引

添加映射字段
Elasticsearch:入门采坑笔记-----索引篇_第5张图片
Elasticsearch:入门采坑笔记-----索引篇_第6张图片

4. 打开与关闭索引

Elasticsearch:入门采坑笔记-----索引篇_第7张图片
索引被关闭后,那么关于这个索引的所有读写操作都会被阻断。
Elasticsearch:入门采坑笔记-----索引篇_第8张图片

5. 冻结与解冻索引

Elasticsearch:入门采坑笔记-----索引篇_第9张图片
冻结索引和关闭索引类似,关闭索引是既不能读,也不能写。而冻结索引是可以读,但是不能写。
Elasticsearch:入门采坑笔记-----索引篇_第10张图片

6. 删除索引

在这里插入图片描述

你可能感兴趣的:(Elasticsearch)