我正在嘗試創建具有兩種模式的索引模板,我的問題是
- 我可以在模板中添加兩個模式嗎?
- 或者唯一的方法是為每個模式創建一個索引模板?
我的政策
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
}
}
}
uj5u.com熱心網友回復:
這里的問題是index.lifecycle.rollover_alias只能附加到單個索引,它是該策略的寫入索引
即 - 您不能將兩個索引附加到一個別名,這兩個索引都是寫索引
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/476912.html
