es学习-索引别名
别名不能重复,也不能喝索引名称重复。(一个索引可以创建多个别名)
语法:
添加一个别名:
url:POST http://192.168.0.108:9200/_aliases/
参数:
{ "actions": [{ "add": { "index": "yingshe", "alias": "yingshealias" } }] }
添加一个别名(多个索引):
两种写法
(1)
{ "actions": [{ "add": { "indices":["test1","test2"] "alias": "yingshealias" } }] }
(2) 新写一个add
删除别名:
url:POST http://192.168.0.108:9200/_aliases/
参数:
{ "actions": [{ "remove": { "index": "yingshe", "alias": "yingshealias" } }] }
1.过滤索引别名:
url:PUT
参数:http://192.168.0.108:9200/test1/
{ "mapping": { "type1": { "properties": { "user": { "type": "string", "index": "not_analyzed" } } } } }
创建过滤别名:
url:POST http://192.168.0.108:9200/_aliases/
参数:
{ "actions": [{ "add": { "index": "test1", "alias": "alias2", "filter": { "term": { "user": "kimchy" } } } }] }