# 别名
POST _aliases
{
"actions": [
{
"add": {
"index": "my-index-000007",
"alias": "my-index"
}
},
{
"add": {
"index": "my-index-000002",
"alias": "my-index"
}
}
]
}
# 设置is_write_index为true 可通过别名写入
# 别名只能存在一个写索引
POST /_aliases
{
"actions": [
{
"add": {
"index": "my-index-000008",
"alias": "my-index",
"is_write_index": true
}
}
]
}
# 删除
POST _aliases
{
"actions": [
{
"remove": {
"index": "my-index-000007",
"alias": "my-index"
}
}
]
}
GET _alias
GET my-index-000002/_alias
# 所有别名为my-index的索引
GET _alias/my-index
GET /my-index/_search
elasticsearch8-学习2
于 2023-12-23 13:40:45 首次发布