Elasticsearch alias别名管理小结
By:授客 QQ:1033553122
测试环境:
Win elasticsearch-5.4.1
PUT test1_index
POST test1_index/doctype/1
{
"name":"shouke",
"addr":"深圳"
}
POST test1_index/doctype/2
{
"name":"shou ke",
"addr":"深圳"
}
POST test1_index/doctype/_search
POST /_aliases
{
"actions": [
{
"add": {
"index": "test1_index",
"alias": "test1_index_alias"
}
}
]
}
说明:index 为要创建别名的“源索引”, alias 别名
搜索验证
POST /test1_index_alias/_search
POST /_aliases
{
"actions": [
{
"remove": {
"index": "test1_index",
"alias": "test1_index_alias"
}
}
]
}
验证
POST /test1_index_alias/_search
PUT /test2_index
POST test2_index/doctype/1
{
"name":"shouke",
"addr":"福建"
}
POST test2_index/doctype/2
{
"name":"shou ke",
"addr":"福建"
}
POST /_aliases
{
"actions": [
{
"add": {
"index": "test1_index",
"alias": "test_index_alias"
}
}
]
}
POST /_aliases
{
"actions": [
{
"remove": {
"index": "test1_index",
&nb