From 5c097f318b3025521d297abbd7e2f57fe60cf132 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Mon, 20 Aug 2018 10:05:34 -0400 Subject: [PATCH] Fix error message --- .../xpack/ml/action/TransportStartDatafeedAction.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java index 35a4ac497293d..d6ebdd0449e98 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartDatafeedAction.java @@ -252,8 +252,10 @@ private ElasticsearchStatusException createUnlicensedError( private ElasticsearchStatusException createUnknownLicenseError( final String datafeedId, final List remoteIndices, final Exception cause) { - final String remoteClusterQualifier = remoteIndices.size() == 1 ? "a remote cluster" : "remote clusters"; - final String licenseTypeQualifier = remoteIndices.size() == 1 ? "" : "s"; + final int numberOfRemoteClusters = RemoteClusterLicenseChecker.remoteClusterAliases(remoteIndices).size(); + assert numberOfRemoteClusters > 0; + final String remoteClusterQualifier = numberOfRemoteClusters == 1 ? "a remote cluster" : "remote clusters"; + final String licenseTypeQualifier = numberOfRemoteClusters == 1 ? "" : "s"; final String message = String.format( Locale.ROOT, "cannot start datafeed [%s] as it uses indices on %s %s but the license type%s could not be verified",