Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move internal index templates to composable templates #61457

Merged
merged 12 commits into from
Aug 27, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public SnapshotLifecycleTemplateRegistry(Settings nodeSettings, ClusterService c
}

@Override
protected List<IndexTemplateConfig> getLegacyTemplateConfigs() {
protected List<IndexTemplateConfig> getComposableTemplateConfigs() {
if (slmHistoryEnabled == false) {
return Collections.emptyList();
}
Expand All @@ -90,9 +90,9 @@ protected String getOrigin() {
}

public boolean validate(ClusterState state) {
boolean allTemplatesPresent = getLegacyTemplateConfigs().stream()
boolean allTemplatesPresent = getComposableTemplateConfigs().stream()
.map(IndexTemplateConfig::getTemplateName)
.allMatch(name -> state.metadata().getTemplates().containsKey(name));
.allMatch(name -> state.metadata().templatesV2().containsKey(name));

Optional<Map<String, LifecyclePolicy>> maybePolicies = Optional
.<IndexLifecycleMetadata>ofNullable(state.metadata().custom(IndexLifecycleMetadata.TYPE))
Expand Down
149 changes: 75 additions & 74 deletions x-pack/plugin/core/src/main/resources/ilm-history.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,84 +2,85 @@
"index_patterns": [
"ilm-history-${xpack.ilm_history.template.version}*"
],
"order": 2147483647,
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0,
"index.auto_expand_replicas": "0-1",
"index.lifecycle.name": "ilm-history-ilm-policy",
"index.lifecycle.rollover_alias": "ilm-history-${xpack.ilm_history.template.version}",
"index.hidden": true,
"index.format": 1
},
"mappings": {
"_doc": {
"dynamic": false,
"properties": {
"@timestamp": {
"type": "date",
"format": "epoch_millis"
},
"policy": {
"type": "keyword"
},
"index": {
"type": "keyword"
},
"index_age":{
"type": "long"
},
"success": {
"type": "boolean"
},
"state": {
"type": "object",
"dynamic": true,
"properties": {
"phase": {
"type": "keyword"
},
"action": {
"type": "keyword"
},
"step": {
"type": "keyword"
},
"failed_step": {
"type": "keyword"
},
"is_auto-retryable_error": {
"type": "keyword"
},
"creation_date": {
"type": "date",
"format": "epoch_millis"
},
"phase_time": {
"type": "date",
"format": "epoch_millis"
},
"action_time": {
"type": "date",
"format": "epoch_millis"
},
"step_time": {
"type": "date",
"format": "epoch_millis"
},
"phase_definition": {
"type": "text"
},
"step_info": {
"type": "text"
"template": {
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0,
"index.auto_expand_replicas": "0-1",
"index.lifecycle.name": "ilm-history-ilm-policy"
},
"mappings": {
"dynamic": false,
"properties": {
"@timestamp": {
"type": "date",
"format": "epoch_millis"
},
"policy": {
"type": "keyword"
},
"index": {
"type": "keyword"
},
"index_age": {
"type": "long"
},
"success": {
"type": "boolean"
},
"state": {
"type": "object",
"dynamic": true,
"properties": {
"phase": {
"type": "keyword"
},
"action": {
"type": "keyword"
},
"step": {
"type": "keyword"
},
"failed_step": {
"type": "keyword"
},
"is_auto-retryable_error": {
"type": "keyword"
},
"creation_date": {
"type": "date",
"format": "epoch_millis"
},
"phase_time": {
"type": "date",
"format": "epoch_millis"
},
"action_time": {
"type": "date",
"format": "epoch_millis"
},
"step_time": {
"type": "date",
"format": "epoch_millis"
},
"phase_definition": {
"type": "text"
},
"step_info": {
"type": "text"
}
}
},
"error_details": {
"type": "text"
}
},
"error_details": {
"type": "text"
}
}
}
},
"_meta": {
"description": "index template for ILM history indices",
"managed": true
},
"priority": 2147483647,
"version": ${xpack.ilm_history.template.version}
}
30 changes: 17 additions & 13 deletions x-pack/plugin/core/src/main/resources/slm-history.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"index_patterns": [
".slm-history-${xpack.slm.template.version}*"
],
"order": 2147483647,
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0,
"index.auto_expand_replicas": "0-1",
"index.lifecycle.name": "slm-history-ilm-policy",
"index.lifecycle.rollover_alias": ".slm-history-${xpack.slm.template.version}",
"index.hidden": true,
"index.format": 1
},
"mappings": {
"_doc": {
"priority": 2147483647,
"template": {
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0,
"index.auto_expand_replicas": "0-1",
"index.lifecycle.name": "slm-history-ilm-policy",
"index.lifecycle.rollover_alias": ".slm-history-${xpack.slm.template.version}",
"index.hidden": true,
"index.format": 1
},
"mappings": {
"dynamic": false,
"properties": {
"@timestamp": {
Expand All @@ -26,7 +26,7 @@
"repository": {
"type": "keyword"
},
"snapshot_name":{
"snapshot_name": {
"type": "keyword"
},
"operation": {
Expand Down Expand Up @@ -57,5 +57,9 @@
}
}
},
"_meta": {
"description": "index template for SLM history indices",
"managed": true
},
"version": ${xpack.slm.template.version}
}
24 changes: 12 additions & 12 deletions x-pack/plugin/core/src/main/resources/triggered-watches.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"index_patterns": [ ".triggered_watches*" ],
"order": 2147483647,
"settings": {
"index.number_of_shards": 1,
"index.auto_expand_replicas": "0-1",
"index.refresh_interval" : "-1",
"index.format": 6,
"index.priority": 900
},
"mappings": {
"_doc": {
"dynamic" : "strict",
"priority": 2147483647,
probakowski marked this conversation as resolved.
Show resolved Hide resolved
"template": {
"settings": {
"index.number_of_shards": 1,
"index.auto_expand_replicas": "0-1",
"index.refresh_interval": "-1",
"index.format": 6,
"index.priority": 900
},
"mappings": {
"dynamic": "strict",
"properties": {
"trigger_event": {
"type": "object",
"dynamic": true,
"enabled" : false,
"enabled": false,
"properties": {
"schedule": {
"type": "object",
Expand Down
Loading