我试图用两种模式创建索引模板,我的问题是
我的政策
PUT _ilm/policy/my_first_policy
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_primary_shard_size": "1b",
"max_docs": 2
}
}
},
"delete": {
"min_age": "1m",
"actions": {
"delete": {}
}
}
}
}
}具有两种模式的索引模板
PUT _index_template/my_first_template
{
"index_patterns": ["test-one-*", "test-two-*"],
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "my_first_policy",
"index.lifecycle.rollover_alias": "my-test-alias"
}
}
}启动索引
PUT test-one-000001
{
"aliases": {
"test-one":{
"is_write_index": true
}
}
}
PUT test-two-000001
{
"aliases": {
"test-two":{
"is_write_index": true
}
}
}我得到以下错误
illegal_argument_exception: index.lifecycle.rollover_alias [my-test-alias] does not point to index [test-one-000001]它似乎使用的是模板中的一个模式,当我使用模板和第一个文档中定义的相同别名时,这就是我的意思。
PUT _index_template/my_first_template
{
"index_patterns": ["test-one-*"],
"template": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"index.lifecycle.name": "my_first_policy",
"index.lifecycle.rollover_alias": "my-test-alias"
}
}
}
PUT test-one-000001
{
"aliases": {
"my-test-alias":{
"is_write_index": true
}
}
}发布于 2022-05-12 05:58:34
这里的问题是index.lifecycle.rollover_alias只能附加到单个索引,它是该策略的写索引
ie -不能将两个索引附加在别名上,这两个索引都是写索引。
https://stackoverflow.com/questions/72208633
复制相似问题