栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

ElasticSearch~ES索引操作~对索引的增删改查

ElasticSearch~ES索引操作~对索引的增删改查

一、创建索引 一、创建索引
PUT /student_test
二、创建索引并且指定分片数量(2个分片,2个副本)
PUT /student
{
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 2
  }
}
三、创建索引并且指定分片数量与Mapping映射
PUT /teacher
{
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 2
  },
  "mappings":{
    "properties":{
      "id":{
        "type":"integer"
      },
      "name":{
        "type":"keyword"
      },
      "age":{
        "type":"long"
      },
      "desc":{
        "type":"text"
      },
      "birthday":{
        "type":"date"
      }
    }
  }
}
二、查看索引 一、查看单个索引信息
GET /teacher
二、查看所有索引
GET /_cat/indices
三、查看指定索引文档总数
GET /student_test/_count
四、查看所有索引文档总数
GET _all/_count
五、查看单个索引切片信息
GET /_cat/shards/student_test?v
六、查看各索引占用内存大小并倒序
GET /_cat/indices?v&h=i,tm&s=tm:desc
七、查看个索引文档数量并倒序
GET /_cat/indices?v&s=docs.count:desc
八、查看健康状态为绿的索引
GET /_cat/indices?v&health=green
三、删除索引 一、删除单个索引
DELETE /student_test1
四、修改索引 一、修改分片副本
PUT /teacher/_settings
{
  "index":{
    "number_of_replicas":4
  }
}
二、新增Mapping映射
POST /teacher/_mapping
{
  "properties":{
    "phone":{
      "type":"keyword"
    }
  }
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/747076.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号