From 066c54b8d5108d6011674f69fa76210d78115844 Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Tue, 1 Aug 2017 16:38:48 -0600 Subject: [PATCH] Disallow : in cluster and index/alias names We use `:` for cross-cluster search (eg `cluster:index`), therefore, we should not allow the ambiguity when allowing cluster or index names. Relates to #23892 --- .../main/java/org/elasticsearch/cluster/ClusterName.java | 3 +++ .../cluster/metadata/MetaDataCreateIndexService.java | 3 +++ .../cluster/metadata/MetaDataCreateIndexServiceTests.java | 1 + docs/reference/migration/migrate_7_0.asciidoc | 8 ++++++++ docs/reference/migration/migrate_7_0/cluster.asciidoc | 7 +++++++ docs/reference/migration/migrate_7_0/indices.asciidoc | 7 +++++++ 6 files changed, 29 insertions(+) create mode 100644 docs/reference/migration/migrate_7_0/cluster.asciidoc create mode 100644 docs/reference/migration/migrate_7_0/indices.asciidoc diff --git a/core/src/main/java/org/elasticsearch/cluster/ClusterName.java b/core/src/main/java/org/elasticsearch/cluster/ClusterName.java index 36676300954e7..ab2efc6061e4e 100644 --- a/core/src/main/java/org/elasticsearch/cluster/ClusterName.java +++ b/core/src/main/java/org/elasticsearch/cluster/ClusterName.java @@ -34,6 +34,9 @@ public class ClusterName implements Writeable { if (s.isEmpty()) { throw new IllegalArgumentException("[cluster.name] must not be empty"); } + if (s.contains(":")) { + throw new IllegalArgumentException("[cluster.name] must not contain ':'"); + } return new ClusterName(s); }, Setting.Property.NodeScope); diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java index 07a97b4f320cb..ae3dc19f62dc1 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java @@ -165,6 +165,9 @@ public static void validateIndexOrAliasName(String index, BiFunction> +* <> + +include::migrate_7_0/cluster.asciidoc[] +include::migrate_7_0/indices.asciidoc[] diff --git a/docs/reference/migration/migrate_7_0/cluster.asciidoc b/docs/reference/migration/migrate_7_0/cluster.asciidoc new file mode 100644 index 0000000000000..b573fc9da40a1 --- /dev/null +++ b/docs/reference/migration/migrate_7_0/cluster.asciidoc @@ -0,0 +1,7 @@ +[[breaking_70_cluster_changes]] +=== Cluster changes + +==== `:` is no longer allowed in cluster name + +Due to cross-cluster search using `:` to separate a cluster and index name, +cluster names may no longer contain `:`. diff --git a/docs/reference/migration/migrate_7_0/indices.asciidoc b/docs/reference/migration/migrate_7_0/indices.asciidoc new file mode 100644 index 0000000000000..eeecacc06fc06 --- /dev/null +++ b/docs/reference/migration/migrate_7_0/indices.asciidoc @@ -0,0 +1,7 @@ +[[breaking_70_indices_changes]] +=== Indices changes + +==== `:` is no longer allowed in index name + +Due to cross-cluster search using `:` to separate a cluster and index name, +index names may no longer contain `:`.