ElasticSearch 集群的索引别名管理

一、索引别名

(一)添加索引别名

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
相关推荐
阿里云大数据AI技术14 小时前
大数据公有云市场第一,阿里云占比47%!
大数据
Lx35218 小时前
Hadoop容错机制深度解析:保障作业稳定运行
大数据·hadoop
christine-rr21 小时前
linux常用命令(4)——压缩命令
linux·服务器·redis
muyun28001 天前
Docker 下部署 Elasticsearch 8 并集成 Kibana 和 IK 分词器
elasticsearch·docker·容器
東雪蓮☆1 天前
深入理解 LVS-DR 模式与 Keepalived 高可用集群
linux·运维·服务器·lvs
乌萨奇也要立志学C++1 天前
【Linux】进程概念(二):进程查看与 fork 初探
linux·运维·服务器
T06205141 天前
工具变量-5G试点城市DID数据(2014-2025年
大数据
向往鹰的翱翔1 天前
BKY莱德因:5大黑科技逆转时光
大数据·人工智能·科技·生活·健康医疗
绿箭柠檬茶1 天前
Ubuntu 服务器配置转发网络访问
服务器·网络·ubuntu
獭.獭.1 天前
Linux -- 信号【上】
linux·运维·服务器