Elasticsearch ILM-ELK
Elasticsearch ILM - ELK
我正在尝试创建具有两种模式的索引模板,我的问题是
- 我可以在模板中添加两个模式吗?
- 或者唯一的方法是为每个模式创建一个索引模板?
我的保单
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
}
}
}
这里的问题是 index.lifecycle.rollover_alias
只能附加到单个索引,它是该策略的写入索引
ie - 你不能将两个索引附加到一个别名上,这两个索引都是写索引
我正在尝试创建具有两种模式的索引模板,我的问题是
- 我可以在模板中添加两个模式吗?
- 或者唯一的方法是为每个模式创建一个索引模板?
我的保单
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
}
}
}
这里的问题是 index.lifecycle.rollover_alias
只能附加到单个索引,它是该策略的写入索引
ie - 你不能将两个索引附加到一个别名上,这两个索引都是写索引