Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow : in cluster and index/alias names #26247

Merged
merged 1 commit into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions core/src/main/java/org/elasticsearch/cluster/ClusterName.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ public static void validateIndexOrAliasName(String index, BiFunction<String, Str
if (index.contains("#")) {
throw exceptionCtor.apply(index, "must not contain '#'");
}
if (index.contains(":")) {
throw exceptionCtor.apply(index, "must not contain ':'");
}
if (index.charAt(0) == '_' || index.charAt(0) == '-' || index.charAt(0) == '+') {
throw exceptionCtor.apply(index, "must not start with '_', '-', or '+'");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public void testValidateIndexName() throws Exception {

validateIndexName("..", "must not be '.' or '..'");

validateIndexName("foo:bar", "must not contain ':'");
}

private void validateIndexName(String indexName, String errorMessage) {
Expand Down
8 changes: 8 additions & 0 deletions docs/reference/migration/migrate_7_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ way to reindex old indices is to use the `reindex` API.

=========================================

[float]
=== Also see:

* <<breaking_70_cluster_changes>>
* <<breaking_70_indices_changes>>

include::migrate_7_0/cluster.asciidoc[]
include::migrate_7_0/indices.asciidoc[]
7 changes: 7 additions & 0 deletions docs/reference/migration/migrate_7_0/cluster.asciidoc
Original file line number Diff line number Diff line change
@@ -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 `:`.
7 changes: 7 additions & 0 deletions docs/reference/migration/migrate_7_0/indices.asciidoc
Original file line number Diff line number Diff line change
@@ -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 `:`.