5.1 创建索引
(1)简单方式
PUT test
响应
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "test"
}
(2)索引名不能包含大写字母
PUT Test
(3)重复创建
PUT test
(4)指定参数
PUT blog
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 1
}
}
响应
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "blog"
}
5.2 查看索引
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"
}
}
}
}
(2)查看多个索引
GET test,blog/_settings
5.3 删除索引
DELETE test
响应
{
"acknowledged": true
}
5.4 索引的打开与关闭
(1)关闭索引
POST blog/_close
(2)尝试插入数据
PUT blog/article/1
{
"title":"test title"
}
(3)重新打开索引
POST blog/_open