一、索引别名
(一)添加索引别名
1.给单个索引添加别名
POST http://10.0.0.101:9200/_aliases
{
"actions":[
{
"add":{
"index":"yedu-linux85",
"alias":"Linux容器运维"
}
},
{
"add":{
"index":"yedu-linux85",
"alias":"DBA"
}
}
]
}
成功案例:


2.给多个索引添加别名
bash
POST http://10.0.0.151:9200/_aliases
{
"actions": [
{
"add": {
"index": "yedu-linux85",
"alias": "Linux2023"
}
},
{
"add": {
"index": "yedu-linux86",
"alias": "Linux2023"
}
},
{
"add": {
"index": "yedu-linux87",
"alias": "Linux2023"
}
}
]
}


(二)查看索引别名
1.查看索引别名
bash
http://10.0.0.151:9200/_aliases
{
"yedu-linux85": {
"aliases": {
"DBA": {},
"Linux2023": {},
"Linux容器运维": {}
}
},
"yedu-linux86": {
"aliases": {
"Linux2023": {}
}
},
"yedu-linux87": {
"aliases": {
"Linux2023": {}
}
},
"oldboyedu-linux85": {
"aliases": {}
}
}


(三)删除索引别名
1.删除索引别名
bash
POST http://10.0.0.151:9200/_aliases
{
"actions": [
{
"remove": {
"index": "yedu-linux85",
"alias": "Linux2023"
}
},
{
"remove": {
"index": "yedu-linux86",
"alias": "Linux2023"
}
}
]
}


(四)修改索引别名
1.修改索引别名
先删除后添加
bash
POST http://10.0.0.151:9200/_aliases
{
"actions": [
{
"remove": {
"index": "yedu-linux85",
"alias": "DBA"
}
},
{
"add": {
"index": "yedu-linux85",
"alias": "数据库运维工程师"
}
}
]
}


二、关闭索引
bash
POST 10.0.0.151:9200/yedu-linux85/_close
三、打开索引
bash
POST 10.0.0.151:9200/yedu-linux85/_open
四、索引默认开发规范
bash
https://www.yedu.com/stadent/1001
GET :
https://www.yedu.com/stadent/view_1001
https://www.yedu.com/stadent/get_1001
POST:
https://www.yedu.com/stadent/create_1001
https://www.yedu.com/stadent/write_1001
https://www.yedu.com/stadent/add_1001
PUT:
https://www.yedu.com/stadent/modify_1001
https://www.yedu.com/stadent/update_1001
DELTE:
https://www.yedu.com/stadent/del_1001
https://www.yedu.com/stadent/delete_1001
https://www.yedu.com/stadent/remove_1001