es之索引的别名操作
为索引school添加一个别名alias1:
1.1:创建索引
PUT student
{
"settings": {"number_of_shards": 3 , "number_of_replicas": 1}
}
PUT school
{
"settings": {"number_of_shards": 3 , "number_of_replicas": 1}
}
1.2:添加别名
POST _aliases
{
"actions" : [{"add" : {"index" : "school" , "alias" : "in1"}}]
}
POST _aliases
{
"actions" : [{"add" : {"index" : "student" , "alias" : "in1"}}]
}
2:查询别名
查询某个index下的别名:
GET school/_alias/*
POST /_aliases
{
"actions": [
{"remove": {"index": "school", "alias": "in1"}}
]
}
4:修改别名
es没有修改别名的操作,只能先删除后添加
POST _aliases
{
"actions" : [{"remove" : {"index" : "student" , "alias" : "in1"}}],
"actions" : [{"add" : {"index" : "student" , "alias" : "in2"}}]
}