请求:
PUT secisland?pretty
{}
返回值:
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "secisland"
}
请求:
PUT secisland4
{
"settings": {
"index":{
"number_of_shards":1,
"number_of_replicas":0
}
}
}
或者:
PUT secisland6
{
"settings": {
"number_of_shards":1,
"number_of_replicas":0
}
}
返回值:
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "secisland4"
}
或者:
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "secisland6"
}
更新副分片数量:
PUT secisland6/_settings
{
"number_of_replicas":0
}
查看索引列表
GET _cat/indices?pretty&v
删除索引secisland4,请求:
DELETE secisland4
删除索引可以使用逗号分隔符或者_all或者*号删除全部索引
DELETE secisland2,secisland3
DELETE _all
DELETE *
请求:
GET secisland
返回值:
{
"secisland" : {
"aliases" : { },
"mappings" : { },
"settings" : {
"index" : {
"creation_date" : "1557044241812",
"number_of_shards" : "1",
"number_of_replicas" : "1",
"uuid" : "rK7qfHg2QUKcwwCCRvq_Xw",
"version" : {
"created" : "7000199"
},
"provided_name" : "secisland"
}
}
}
}
请求:
GET secisland/_settings
返回值:
{
"secisland" : {
"settings" : {
"index" : {
"creation_date" : "1557044241812",
"number_of_shards" : "1",
"number_of_replicas" : "1",
"uuid" : "rK7qfHg2QUKcwwCCRvq_Xw",
"version" : {
"created" : "7000199"
},
"provided_name" : "secisland"
}
}
}
}
可以使用通配符获取多个索引,或者使用_all或者*号获取全部索引。
请求:
GET secisland*
或者:
GET */_settings
返回值:
{
"secisland" : {
"aliases" : { },
"mappings" : { },
"settings" : {
"index" : {
"creation_date" : "1557044241812",
"number_of_shards" : "1",
"number_of_replicas" : "1",
"uuid" : "rK7qfHg2QUKcwwCCRvq_Xw",
"version" : {
"created" : "7000199"
},
"provided_name" : "secisland"
}
}
},
"secisland2" : {
"aliases" : { },
"mappings" : { },
"settings" : {
"index" : {
"creation_date" : "1557044425897",
"number_of_shards" : "1",
"number_of_replicas" : "1",
"uuid" : "xtENDowIR9q6pACyejuZjA",
"version" : {
"created" : "7000199"
},
"provided_name" : "secisland2"
}
}
}
}
或者:
{
"secisland2" : {
"settings" : {
"index" : {
"creation_date" : "1557044425897",
"number_of_shards" : "1",
"number_of_replicas" : "1",
"uuid" : "xtENDowIR9q6pACyejuZjA",
"version" : {
"created" : "7000199"
},
"provided_name" : "secisland2"
}
}
},
"secisland" : {
"settings" : {
"index" : {
"creation_date" : "1557044241812",
"number_of_shards" : "1",
"number_of_replicas" : "1",
"uuid" : "rK7qfHg2QUKcwwCCRvq_Xw",
"version" : {
"created" : "7000199"
},
"provided_name" : "secisland"
}
}
}
}
关闭:POST secisland/_close
打开:POST secisland/_open
关闭的索引只能显示索引的元数据信息,不能够进行读写操作。
可以同时打开或者关闭多个索引。如果指向不存在的索引则会抛出错误,可以使用配置ignore_unavailable=true,不显示异常。
全部索引可以用_all或者*打开或者关闭。因为关闭的索引会继续占用磁盘空间而不能使用,所以在一定程度上造成磁盘空间的浪费。
POST _reindex
{
"source": {"index": "secisland"},
"dest": {"index": "secisland4"}
}