五十八、Elasticsearch索引管理-创建、修改以及删除索引

1、创建索引语法

PUT /index
{
  "settings": {...},
  "mappings": {
    "type_one" : {...},
    "type_two" : {...}
    ...
  }
}

例如:

PUT /my_index
{
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 0
  },
  "mappings": {
    "my_type" : {
      "properties": {
        "my_field" : {
          "type": "text"
        }
      }
    }
  }
}

2、修改索引

将shard副本从0变成1

PUT /my_index/_settings
{
  "number_of_replicas": 1
}

3、删除索引

DELETE /my_index
DELETE /index_one,index_two
DELETE /index_*
DELETE /_all

若有兴趣,欢迎来加入群,【Java初学者学习交流群】:458430385,此群有Java开发人员、UI设计人员和前端工程师。有问必答,共同探讨学习,一起进步!
欢迎关注我的微信公众号【Java码农社区】,会定时推送各种干货:


qrcode_for_gh_577b64e73701_258.jpg
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容