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

6.1 创建索引

(1)简单方式

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

ElasticSearch 6.x 学习笔记:6.索引_第1张图片

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

PUT Test

ElasticSearch 6.x 学习笔记:6.索引_第2张图片
(3)重复创建

PUT test

ElasticSearch 6.x 学习笔记:6.索引_第3张图片

(4)指定参数

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

ElasticSearch 6.x 学习笔记:6.索引_第4张图片

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"
      }
    }
  }
}

ElasticSearch 6.x 学习笔记:6.索引_第5张图片

(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"
      }
    }
  }
}

ElasticSearch 6.x 学习笔记:6.索引_第6张图片

6.3 删除索引

DELETE test
{
  "acknowledged": true
}

ElasticSearch 6.x 学习笔记:6.索引_第7张图片

6.4 索引的打开与关闭

(1)关闭索引

POST blog/_close
{
  "acknowledged": true
}

ElasticSearch 6.x 学习笔记:6.索引_第8张图片
(2)尝试插入数据

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

index_closed_exception
ElasticSearch 6.x 学习笔记:6.索引_第9张图片
(3)重新打开索引

POST blog/_open

ElasticSearch 6.x 学习笔记:6.索引_第10张图片

你可能感兴趣的:(Elasticsearch,6.x,学习笔记)