- ElasticSearch 索引别名
- ElasticSearch 属性别名
- ElasticSearch ingest
- 参考文献
版本信息:7.13.4
ElasticSearch 索引别 名
索引别名
-
根据索引api创建别名
# 删除索引
DELETE my-index-000001
# 索引别名
PUT my-index-0000001
{
"aliases": {
"my-index": {}
}
}
# 创建索引
POST my-index/_doc
{
"name":"my-index"
}
# 根据索引查询数据
GET my-index/_search
# 原索引创建索引
POST my-index-0000001/_doc
{
"name":"mymy-index-0000001"
}
# 原索引查询
GET my-index-0000001/_search
# 索引别名信息查询
GET my-index-0000001/_alias
# 删除索引别名
DELETE my-index-0000001/_alias/my-index
# 添加索引别名
POST my-index-0000001/_alias/my-index -
_alias创建别名is_write_index控制是否可以写数据,默认是truerouting路由配置别名(分片别名),可以分为search_routing和index_routingfilter条件别名,根据条件设置对应的别名查询
# 别名是否存在
HEAD _alias/my-index
# 查询别名使用的索引
GET _alias/my-index
# 别名api添加
POST _aliases
{
"actions": [
{
"add": {
"index": "my-index-0000001",
"alias": "my-index-01"
}
}
]
}
# 别名上的别名是不可以的,报错
POST _aliases
{
"actions": [
{
"add": {
"index": "my-index-01",
"alias": "my-index-02"
}
}
]
}
# 删除别名
POST _aliases
{
"actions": [
{
"remove": {
"index": "my-index-0000001",
"alias": "my-index-01"
}
}
]
}
# 读索引别名,不支持写索引操作
POST _aliases
{
"actions": [
{
"add": {
"index": "my-index-0000001",
"alias": "my-read-index",
"is_write_index":false
}
}
]
}
# 只读,不可以写数据
POST my-read-index/_doc
{
"name":"my-read-index"
}
# 可以查询
GET my-read-index/_search
# 根据路由创建分片别名
POST _aliases
{
"actions": [
{
"add": {
"index": "my-index-0000001",
"alias": "my-routing-index",
"routing": "1"
}
}
]
}
# 查询数据
GET my-routing-index/_search
# 根据filter 条件创建别名
POST _aliases
{
"actions": [
{
"add": {
"index": "my-index-0000001",
"alias": "my-filter-index",
"filter": {
"match": {
"name": "0000001"
}
}
}
}
]
}
# 查询数据
GET my-filter-index/_search
滚动别名
索引名称为6位数字结尾并用0左填充,比如
my-index-000001
查询参数
dry_run检查是否已经触发条件了但是没有滚动,默认为falsewait_for_active_shards操作的分片数,默认为1