org.elasticsearch.xpack.core.upgrade.UpgradeField Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x-pack-core Show documentation
Show all versions of x-pack-core Show documentation
Elasticsearch Expanded Pack Plugin - Core
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.core.upgrade;
import org.elasticsearch.cluster.metadata.IndexMetadata;
public final class UpgradeField {
// this is the required index.format setting for 6.0 services (watcher and security) to start up
// this index setting is set by the upgrade API or automatically when a 6.0 index template is created
public static final int EXPECTED_INDEX_FORMAT_VERSION = 6;
private UpgradeField() {}
/**
* Checks the format of an internal index and returns true if the index is up to date or false if upgrade is required
*/
public static boolean checkInternalIndexFormat(IndexMetadata indexMetadata) {
return indexMetadata.getSettings().getAsInt(IndexMetadata.INDEX_FORMAT_SETTING.getKey(), 0) == EXPECTED_INDEX_FORMAT_VERSION;
}
}