【ElasticSearch】别名

1、查询别名

查询所有

GET /_alias

查询单个

GET /admin-service/_alias

2、创建别名

批量创建

POST /_aliases
{
    "actions": [
        {
            "add": {
                "index": "admin-service",
                "alias": "admin-service-log"
            }
        },
        {
            "add": {
                "index": "user-service",
                "alias": "user-service-log"
            }
        }
    ]
}

重写索引

POST /_aliases
{
    "actions": [
        {
            "add": {
                "index": "admin-service",
                "alias": "admin-service-log",
                "is_write_index": true
            }
        }
    ]
}

单个创建

PUT  /admin-service/_alias/admin-service-log

3、修改别名

批量修改,删除后添加

POST /_aliases
{
    "actions": [
        {
            "remove": {
                "index": "admin-service",
                "alias": "admin-service-log"
            }
        },
        {
            "add": {
                "index": "admin-service",
                "alias": "admin-service-log2"
            }
        }
    ]
}

4、删除别名

批量删除

POST /_aliases
{
    "actions": [
        {
            "remove": {
                "index": "admin-service",
                "alias": "admin-service-log"
            }
        }
    ]
}

单个删除

DELETE  /admin-service/_alias/admin-service-log

 

参考博文:https://blog.csdn.net/qq330983778/article/details/102980861

posted @ 2022-08-16 11:32  翠微  阅读(202)  评论(0编辑  收藏  举报