diff --git a/src/main/java/org/elasticsearch/alerts/transport/actions/ack/TransportAckAlertAction.java b/src/main/java/org/elasticsearch/alerts/transport/actions/ack/TransportAckAlertAction.java index 8959391d89b..277c0f9d012 100644 --- a/src/main/java/org/elasticsearch/alerts/transport/actions/ack/TransportAckAlertAction.java +++ b/src/main/java/org/elasticsearch/alerts/transport/actions/ack/TransportAckAlertAction.java @@ -8,11 +8,9 @@ package org.elasticsearch.alerts.transport.actions.ack; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction; import org.elasticsearch.alerts.AlertManager; import org.elasticsearch.alerts.AlertsStore; -import org.elasticsearch.alerts.actions.AlertActionManager; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -22,10 +20,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - /** * Performs the delete operation. */ @@ -67,10 +61,7 @@ public class TransportAckAlertAction extends TransportMasterNodeOperationAction< @Override protected ClusterBlockException checkBlock(AckAlertRequest request, ClusterState state) { - String[] indices = state.metaData().concreteIndices(IndicesOptions.lenientExpandOpen(), AlertActionManager.ALERT_HISTORY_INDEX_PREFIX + "*"); - List indicesToCheck = new ArrayList<>(Arrays.asList(indices)); - indicesToCheck.add(AlertsStore.ALERT_INDEX); - return state.blocks().indicesBlockedException(ClusterBlockLevel.WRITE, indicesToCheck.toArray(new String[indicesToCheck.size()])); + return state.blocks().indicesBlockedException(ClusterBlockLevel.WRITE, new String[]{AlertsStore.ALERT_INDEX}); } diff --git a/src/main/java/org/elasticsearch/alerts/transport/actions/delete/TransportDeleteAlertAction.java b/src/main/java/org/elasticsearch/alerts/transport/actions/delete/TransportDeleteAlertAction.java index 0aa5a24ffd1..97a8ae6e8ba 100644 --- a/src/main/java/org/elasticsearch/alerts/transport/actions/delete/TransportDeleteAlertAction.java +++ b/src/main/java/org/elasticsearch/alerts/transport/actions/delete/TransportDeleteAlertAction.java @@ -8,11 +8,9 @@ package org.elasticsearch.alerts.transport.actions.delete; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction; import org.elasticsearch.alerts.AlertManager; import org.elasticsearch.alerts.AlertsStore; -import org.elasticsearch.alerts.actions.AlertActionManager; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -22,10 +20,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - /** * Performs the delete operation. */ @@ -67,10 +61,7 @@ public class TransportDeleteAlertAction extends TransportMasterNodeOperationActi @Override protected ClusterBlockException checkBlock(DeleteAlertRequest request, ClusterState state) { - String[] indices = state.metaData().concreteIndices(IndicesOptions.lenientExpandOpen(), AlertActionManager.ALERT_HISTORY_INDEX_PREFIX + "*"); - List indicesToCheck = new ArrayList<>(Arrays.asList(indices)); - indicesToCheck.add(AlertsStore.ALERT_INDEX); - return state.blocks().indicesBlockedException(ClusterBlockLevel.WRITE, indicesToCheck.toArray(new String[indicesToCheck.size()])); + return state.blocks().indicesBlockedException(ClusterBlockLevel.WRITE, new String[]{AlertsStore.ALERT_INDEX}); } diff --git a/src/main/java/org/elasticsearch/alerts/transport/actions/put/TransportPutAlertAction.java b/src/main/java/org/elasticsearch/alerts/transport/actions/put/TransportPutAlertAction.java index ad0a92cc150..bcc1e88ae3e 100644 --- a/src/main/java/org/elasticsearch/alerts/transport/actions/put/TransportPutAlertAction.java +++ b/src/main/java/org/elasticsearch/alerts/transport/actions/put/TransportPutAlertAction.java @@ -9,11 +9,9 @@ import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction; import org.elasticsearch.alerts.AlertManager; import org.elasticsearch.alerts.AlertsStore; -import org.elasticsearch.alerts.actions.AlertActionManager; import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -23,10 +21,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - /** */ public class TransportPutAlertAction extends TransportMasterNodeOperationAction { @@ -68,11 +62,7 @@ public class TransportPutAlertAction extends TransportMasterNodeOperationAction< @Override protected ClusterBlockException checkBlock(PutAlertRequest request, ClusterState state) { request.beforeLocalFork(); // This is the best place to make the alert source safe - String[] indices = state.metaData().concreteIndices(IndicesOptions.lenientExpandOpen(), AlertActionManager.ALERT_HISTORY_INDEX_PREFIX + "*"); - List indicesToCheck = new ArrayList<>(Arrays.asList(indices)); - indicesToCheck.add(AlertsStore.ALERT_INDEX); - return state.blocks().indicesBlockedException(ClusterBlockLevel.WRITE, indicesToCheck.toArray(new String[indicesToCheck.size()])); - + return state.blocks().indicesBlockedException(ClusterBlockLevel.WRITE, new String[]{AlertsStore.ALERT_INDEX}); } }