diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java index 510534abc62..24ca4579055 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java @@ -208,7 +208,9 @@ public class Watcher implements ActionPlugin, ScriptPlugin { transportClient = "transport".equals(settings.get(Client.CLIENT_TYPE_SETTING_S.getKey())); this.enabled = XPackSettings.WATCHER_ENABLED.get(settings); this.transportClientMode = XPackPlugin.transportClientMode(settings); - validAutoCreateIndex(settings); + if (enabled && transportClientMode == false) { + validAutoCreateIndex(settings); + } } public Collection createComponents(Clock clock, ScriptService scriptService, InternalClient internalClient, diff --git a/plugin/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginDisableTests.java b/plugin/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginDisableTests.java index 9de8d166857..4215bf1aaae 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginDisableTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/watcher/WatcherPluginDisableTests.java @@ -12,6 +12,7 @@ import java.util.Collections; import org.apache.http.HttpStatus; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; +import org.elasticsearch.action.support.AutoCreateIndex; import org.elasticsearch.client.ResponseException; import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; @@ -37,6 +38,8 @@ public class WatcherPluginDisableTests extends ESIntegTestCase { return Settings.builder() .put(super.nodeSettings(nodeOrdinal)) .put(XPackSettings.WATCHER_ENABLED.getKey(), false) + // prevent auto index creation, as watcher is disabled this should work + .put(AutoCreateIndex.AUTO_CREATE_INDEX_SETTING.getKey(), false) // disable security because of query cache check and authentication/authorization .put(XPackSettings.SECURITY_ENABLED.getKey(), false)