一、创建索引
一、创建索引
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"
}
}
}