Skip to content

Commit 60f4d22

Browse files
authored
Change default value of action.destructive_requires_name to True. (#66908)
This PR sets the default value of `action.destructive_requires_name` to `true.` Fixes #61074. Additionally, we set this value explicitly in test classes that rely on wildcard deletions to clear test state.
1 parent b078512 commit 60f4d22

File tree

14 files changed

+35
-20
lines changed

14 files changed

+35
-20
lines changed

buildSrc/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,8 @@ private void createConfiguration() {
11801180
baseConfig.put("cluster.service.slow_master_task_logging_threshold", "5s");
11811181
}
11821182

1183+
baseConfig.put("action.destructive_requires_name", "false");
1184+
11831185
HashSet<String> overriden = new HashSet<>(baseConfig.keySet());
11841186
overriden.retainAll(settings.keySet());
11851187
overriden.removeAll(OVERRIDABLE_SETTINGS);

distribution/docker/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ services:
3030
- xpack.http.ssl.verification_mode=certificate
3131
- xpack.security.transport.ssl.verification_mode=certificate
3232
- xpack.license.self_generated.type=trial
33+
- action.destructive_requires_name=false
3334
volumes:
3435
- ./build/repo:/tmp/es-repo
3536
- ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem
@@ -81,6 +82,7 @@ services:
8182
- xpack.http.ssl.verification_mode=certificate
8283
- xpack.security.transport.ssl.verification_mode=certificate
8384
- xpack.license.self_generated.type=trial
85+
- action.destructive_requires_name=false
8486
volumes:
8587
- ./build/repo:/tmp/es-repo
8688
- ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem

distribution/src/config/elasticsearch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ ${path.logs}
7777
#
7878
# ---------------------------------- Various -----------------------------------
7979
#
80-
# Require explicit names when deleting indices:
80+
# Allow wildcard deletion of indices:
8181
#
82-
#action.destructive_requires_name: true
82+
#action.destructive_requires_name: false

docs/reference/index-modules/blocks.asciidoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ PUT /my-index-000001/_block/write
7474

7575
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
7676
+
77-
To add blocks to all indices, use `_all` or `*`. To disallow the adding
78-
of blocks to indices with `_all` or wildcard expressions,
79-
change the `action.destructive_requires_name` cluster setting to `true`.
77+
By default, you must explicitly name the indices you are adding blocks to.
78+
To allow the adding of blocks to indices with `_all`, `*``, or other wildcard
79+
expressions, change the `action.destructive_requires_name` setting to `false`.
8080
You can update this setting in the `elasticsearch.yml` file
8181
or using the <<cluster-update-settings,cluster update settings>> API.
8282
`<block>`::

docs/reference/indices/close.asciidoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ include::{es-repo-dir}/indices/open-close.asciidoc[tag=closed-index]
3838
include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=index]
3939
+
4040
To close all indices, use `_all` or `*`.
41-
To disallow the closing of indices with `_all` or wildcard expressions,
42-
change the `action.destructive_requires_name` cluster setting to `true`.
41+
By default, you must explicitly name the indices you are closing.
42+
To specify indices to close with `_all`, `*``, or other wildcard
43+
expressions, change the `action.destructive_requires_name` setting to `false`.
4344
You can update this setting in the `elasticsearch.yml` file
4445
or using the <<cluster-update-settings,cluster update settings>> API.
4546

docs/reference/indices/delete-index.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ delete.
3636
In this parameter, wildcard expressions match only open, concrete indices. You
3737
cannot delete an index using an <<indices-aliases,alias>>.
3838

39-
To delete all indices, use `_all` or `*` . To disallow the deletion of indices
40-
with `_all` or wildcard expressions, change the
41-
`action.destructive_requires_name` cluster setting to `true`. You can update
42-
this setting in the `elasticsearch.yml` file or using the
39+
By default, you must explicitly name the indices you are deleting.
40+
To specify indices to delete with `_all`, `*``, or other wildcard
41+
expressions, change the `action.destructive_requires_name` setting to `false`.
42+
You can update this setting in the `elasticsearch.yml` file or using the
4343
<<cluster-update-settings,cluster update settings>> API.
4444

4545
NOTE: You cannot delete the current write index of a data stream. To delete the

docs/reference/indices/open-close.asciidoc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ You can open and close multiple indices. An error is thrown
5353
if the request explicitly refers to a missing index. This behaviour can be
5454
disabled using the `ignore_unavailable=true` parameter.
5555

56-
All indices can be opened or closed at once using `_all` as the index name
57-
or specifying patterns that identify them all (e.g. `*`).
5856

59-
Identifying indices via wildcards or `_all` can be disabled by setting the
60-
`action.destructive_requires_name` flag in the config file to `true`.
57+
By default, you must explicitly name the indices you are opening or closing.
58+
To open or close indices with `_all`, `*``, or other wildcard
59+
expressions, change the `action.destructive_requires_name` setting to `false`.
6160
This setting can also be changed via the cluster update settings api.
6261

6362
Closed indices consume a significant amount of disk-space which can cause
@@ -88,10 +87,10 @@ index creation applies to the `_open` and `_close` index actions as well.
8887
Comma-separated list of data streams, indices, and index aliases used to limit
8988
the request. Wildcard (`*`) expressions are supported.
9089
+
91-
To target all data streams and indices, use `_all` or `*`.
9290
+
93-
To disallow use of `_all` or wildcard expressions,
94-
change the `action.destructive_requires_name` cluster setting to `true`.
91+
By default, you must explicitly name the indices you using to limit the request.
92+
To limit a request using `_all`, `*``, or other wildcard
93+
expressions, change the `action.destructive_requires_name` setting to `false`.
9594
You can update this setting in the `elasticsearch.yml` file
9695
or using the <<cluster-update-settings,cluster update settings>> API.
9796

qa/os/src/test/java/org/elasticsearch/packaging/util/ServerUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public static void runElasticsearchTests() throws Exception {
229229
String count = makeRequest(Request.Get("http://localhost:9200/_count?pretty"));
230230
assertThat(count, containsString("\"count\" : 2"));
231231

232-
makeRequest(Request.Delete("http://localhost:9200/_all"));
232+
makeRequest(Request.Delete("http://localhost:9200/library"));
233233
}
234234

235235
public static String makeRequest(Request request) throws Exception {

qa/remote-clusters/docker-compose-oss.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ services:
1616
- cluster.routing.allocation.disk.watermark.high=1b
1717
- cluster.routing.allocation.disk.watermark.flood_stage=1b
1818
- node.store.allow_mmap=false
19+
- action.destructive_requires_name=false
1920
volumes:
2021
- ./build/oss-repo:/tmp/es-repo
2122
- ./build/logs/oss-1:/usr/share/elasticsearch/logs
@@ -50,6 +51,7 @@ services:
5051
- cluster.routing.allocation.disk.watermark.high=1b
5152
- cluster.routing.allocation.disk.watermark.flood_stage=1b
5253
- node.store.allow_mmap=false
54+
- action.destructive_requires_name=false
5355
volumes:
5456
- ./build/oss-repo:/tmp/es-repo
5557
- ./build/logs/oss-2:/usr/share/elasticsearch/logs

qa/remote-clusters/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ services:
3030
- xpack.http.ssl.verification_mode=certificate
3131
- xpack.security.transport.ssl.verification_mode=certificate
3232
- xpack.license.self_generated.type=trial
33+
- action.destructive_requires_name=false
3334
volumes:
3435
- ./build/repo:/tmp/es-repo
3536
- ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem
@@ -82,6 +83,7 @@ services:
8283
- xpack.http.ssl.verification_mode=certificate
8384
- xpack.security.transport.ssl.verification_mode=certificate
8485
- xpack.license.self_generated.type=trial
86+
- action.destructive_requires_name=false
8587
volumes:
8688
- ./build/repo:/tmp/es-repo
8789
- ./build/certs/testnode.pem:/usr/share/elasticsearch/config/testnode.pem

0 commit comments

Comments
 (0)