1,创建索引:
put blog
{
"settings":{
"number_of_shards":3,
"number_of_replicas":0
}
}
返回值为:
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "blog"
}
注:
"number_of_shards": 分片数
"number_of_replicas":副本数
2,elastic 创建索引完成后分片数是不可修改的,但是副本数是可以修改的
put blog/_settings
{
"number_of_replicas":1
}
返回值是:
{
"acknowledged": true
}
3,elastic 对索引的读写操作的限制:
blocks.read_only:true
blocks.read:true
blocks.write:true
4,该索引添加别名:
post _aliases
{
"actions":[
{
"add":{
"index":"blog",
"alias":"blog_alias"
}
}
]
}
返回值:
{
"acknowledged": true
}