美文网首页ElastichSearchelasticsearch玩转大数据
五十八、Elasticsearch索引管理-创建、修改以及删除索

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

作者: 编程界的小学生 | 来源:发表于2017-07-11 17:40 被阅读110次

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

相关文章

网友评论

    本文标题:五十八、Elasticsearch索引管理-创建、修改以及删除索

    本文链接:https://www.haomeiwen.com/subject/ddmmhxtx.html