diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/BackwardsCompatibilityAliasesResource.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/BackwardsCompatibilityAliasesResource.java index 471b3ee4854..e251ac70757 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/BackwardsCompatibilityAliasesResource.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/BackwardsCompatibilityAliasesResource.java @@ -60,7 +60,8 @@ public class BackwardsCompatibilityAliasesResource extends HttpResource { request.startObject().startArray("actions"); for (Map.Entry e : indices.entrySet()) { String index = e.getKey(); - String alias = ".monitoring-es-2-" + index.substring(".marvel-es-1-".length()); + // we add a suffix so that it will not collide with today's monitoring index following an upgrade + String alias = ".monitoring-es-2-" + index.substring(".marvel-es-1-".length()) + "-alias"; if (false == aliasesForIndex(e.getValue()).contains(alias)) { needNewAliases = true; addAlias(request, index, alias); diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java index 4c113ea4c99..76e23d01755 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporter.java @@ -397,7 +397,8 @@ public class LocalExporter extends Exporter implements ClusterStateListener, Cle for (IndexMetaData index : clusterState.metaData()) { String name = index.getIndex().getName(); if (name.startsWith(".marvel-es-1-")) { - String alias = ".monitoring-es-2-" + name.substring(".marvel-es-1-".length()); + // we add a suffix so that it will not collide with today's monitoring index following an upgrade + String alias = ".monitoring-es-2-" + name.substring(".marvel-es-1-".length()) + "-alias"; if (index.getAliases().containsKey(alias)) continue; if (request == null) { request = new IndicesAliasesRequest(); diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java index 06cdc1c8828..ba9f1e796b7 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java @@ -12,7 +12,6 @@ import com.squareup.okhttp.mockwebserver.MockWebServer; import com.squareup.okhttp.mockwebserver.RecordedRequest; import org.elasticsearch.Version; -import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.DocWriteRequest; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; import org.elasticsearch.action.bulk.BulkRequest; @@ -606,7 +605,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase { if (bwcIndexesExist) { int timestampIndexes = between(1, 100); for (int i = 0; i < timestampIndexes; i++) { - writeIndex(response, ".marvel-es-1-" + i, bwcAliasesExist ? ".monitoring-es-2-" + i : "ignored"); + writeIndex(response, ".marvel-es-1-" + i, bwcAliasesExist ? ".monitoring-es-2-" + i + "-alias" : "ignored"); } } response.endObject();