index templates: use correct property to extract version from index template from cluster state

Original commit: elastic/x-pack-elasticsearch@ab86054c7f
This commit is contained in:
Martijn van Groningen 2015-04-23 18:28:51 +02:00
parent 345f610bdf
commit 096e00caed

View File

@ -71,12 +71,12 @@ public class TemplateUtils extends AbstractComponent {
IndexTemplateMetaData templateMetaData = state.metaData().templates().get(templateName);
if (templateMetaData != null) {
int foundVersion = templateMetaData.getSettings().getAsInt("index.watches.template_version", -1);
int foundVersion = templateMetaData.getSettings().getAsInt("index.watcher.template_version", -1);
if (foundVersion < 0) {
logger.warn("found an existing index template [{}] but couldn't extract it's version. leaving it as is.", templateName);
return;
} else if (foundVersion >= expectedVersion) {
logger.info("accepting existing index template [{}] (version [{}], needed [{}])", templateName, foundVersion, expectedVersion);
logger.debug("accepting existing index template [{}] (version [{}], needed [{}])", templateName, foundVersion, expectedVersion);
return;
} else {
logger.info("replacing existing index template [{}] (version [{}], needed [{}])", templateName, foundVersion, expectedVersion);