ElasticSearch 6.x 学习笔记:6.索引

6.1 创建索引

(1)简单方式

PUT test
{
  "acknowledged": true,
  "shards_acknowledged": true,
  "index": "test"
}

这里写图片描述

(2)索引名不能包含大些字母

PUT Test

这里写图片描述
(3)重复创建

PUT test

这里写图片描述

(4)指定参数

PUT blog
{
  "settings": {
    "number_of_shards": 3,
    "number_of_replicas": 1
  } 
}
{
  "acknowledged": true,
  "shards_acknowledged": true,
  "index": "blog"
}

这里写图片描述

6.2 查看索引

(1)查看指定索引的配置信息

GET blog/_settings
{
  "blog": {
    "settings": {
      "index": {
        "creation_date": "1515458969949",
        "number_of_shards": "3",
        "number_of_replicas": "1",
        "uuid": "A7pKNO7bTgucu1uNgmXlQg",
        "version": {
          "created": "5060399" },
        "provided_name": "blog"
      }
    }
  }
}

这里写图片描述

(2)查看多个索引

GET test,blog/_settings
{
  "test": {
    "settings": {
      "index": {
        "creation_date": "1515460501267",
        "number_of_shards": "5",
        "number_of_replicas": "1",
        "uuid": "FfVJ9w9bSxqyqvh7r1UL7w",
        "version": {
          "created": "5060399" },
        "provided_name": "test"
      }
    }
  },
  "blog": {
    "settings": {
      "index": {
        "creation_date": "1515459619703",
        "number_of_shards": "3",
        "number_of_replicas": "1",
        "uuid": "6x9RQQ5KRoStK57T88VhmA",
        "version": {
          "created": "5060399" },
        "provided_name": "blog"
      }
    }
  }
}

这里写图片描述

6.3 删除索引

DELETE test
{
  "acknowledged": true
}

这里写图片描述

6.4 索引的打开与关闭

(1)关闭索引

POST blog/_close
{
  "acknowledged": true
}

这里写图片描述
(2)尝试插入数据

PUT blog/article/1
{
  "title":"test title"  
}

index_closed_exception
这里写图片描述
(3)重新打开索引

POST blog/_open

这里写图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值