[ML] Add license downgrade warning (elastic/x-pack-elasticsearch#1912)
When applying a license that will cause ML to be disabled, a warning
to this effect is now included in the acknowledgement messages.
relates elastic/x-pack-elasticsearch#1888
Original commit: elastic/x-pack-elasticsearch@e453f20f58658776c96e2c8a164733b37f3c2569
@@ -71,6 +71,7 @@ public class XPackLicenseState {
messages.put(XPackPlugin.WATCHER, XPackLicenseState::watcherAcknowledgementMessages);
messages.put(XPackPlugin.MONITORING, XPackLicenseState::monitoringAcknowledgementMessages);
messages.put(XPackPlugin.GRAPH, XPackLicenseState::graphAcknowledgementMessages);
+ messages.put(XPackPlugin.MACHINE_LEARNING, XPackLicenseState::machineLearningAcknowledgementMessages);
messages.put(XPackPlugin.LOGSTASH, XPackLicenseState::logstashAcknowledgementMessages);
ACKNOWLEDGMENT_MESSAGES = Collections.unmodifiableMap(messages);
}
@@ -177,6 +178,21 @@ public class XPackLicenseState {
return Strings.EMPTY_ARRAY;
}
+ private static String[] machineLearningAcknowledgementMessages(OperationMode currentMode, OperationMode newMode) {
+ switch (newMode) {
+ case BASIC:
+ case STANDARD:
+ case GOLD:
+ switch (currentMode) {
+ case TRIAL:
+ case PLATINUM:
+ return new String[] { "Machine learning will be disabled" };
+ }
+ break;
+ }
+ return Strings.EMPTY_ARRAY;
+ }
+
private static String[] logstashAcknowledgementMessages(OperationMode currentMode, OperationMode newMode) {
switch (newMode) {
case BASIC:
