Elasticsearch Index Aliases详解
index aliases,索引别名,有点类似名称映射,一个索引别名可以映射多个真实索引,索引别名在定义时还支持filter,构成同一个索引,不同的视图。 思考:一个索引别名可以映射成多个索引,那如果向一个别名添加一个文档时,会在该别名下对应的所有索引下都创建一个文档? 1、如何创建索引别名 POST /_aliases { "actions" : [ { "remove" : { "index" : "test1", "alias" : "alias1" } }, { "add" : { "index" : "test2", "alias" : "alias1" } } ] } 索引创建API,支持add、remove操作,当前Restfull java客户端未封装该方法。 为索引创建别名,也可以在创建索引API中指定: PUT test { "aliases" : { "alias_1" : {}, "alias_2" : { "filter" : { "term" : {"user" : "kimchy" } }, "routing" : "kimchy" } } } 2、Fil...