Skip to content

Commit ec80f78

Browse files
authored
[Fleet] Remove ILM policy from fleet files indices and make them hidden (#94651) (#94668)
* Remove ILM policy from files indices and make them hidden * use correct setting for hidden and auto_expand * fix tests * remove unused imports
1 parent 93ba778 commit ec80f78

File tree

3 files changed

+4
-24
lines changed

3 files changed

+4
-24
lines changed

x-pack/plugin/core/src/main/resources/fleet-file-data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
},
1111
"template" : {
1212
"settings": {
13-
"index.lifecycle.name": ".fleet-file-data-ilm-policy",
14-
"auto_expand_replicas": "0-1"
13+
"index.auto_expand_replicas": "0-1",
14+
"index.hidden": true
1515
},
1616
"mappings": {
1717
"_doc": {

x-pack/plugin/core/src/main/resources/fleet-files.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
},
1111
"template": {
1212
"settings": {
13-
"index.lifecycle.name": ".fleet-files-ilm-policy",
14-
"index.auto_expand_replicas": "0-1"
13+
"index.auto_expand_replicas": "0-1",
14+
"index.hidden": true
1515
},
1616
"mappings": {
1717
"_doc": {

x-pack/plugin/fleet/src/javaRestTest/java/org/elasticsearch/xpack/fleet/FleetSystemIndicesIT.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import org.apache.http.util.EntityUtils;
1111
import org.elasticsearch.client.Request;
12-
import org.elasticsearch.client.RequestOptions;
1312
import org.elasticsearch.client.Response;
1413
import org.elasticsearch.common.settings.Settings;
1514
import org.elasticsearch.common.util.concurrent.ThreadContext;
@@ -18,7 +17,6 @@
1817
import org.elasticsearch.test.rest.ESRestTestCase;
1918
import org.elasticsearch.xcontent.XContentType;
2019

21-
import java.util.List;
2220
import java.util.Map;
2321

2422
import static org.hamcrest.Matchers.containsString;
@@ -40,22 +38,6 @@ protected Settings restClientSettings() {
4038
.build();
4139
}
4240

43-
private void expectSystemIndexWarning(Request request, String indexName) {
44-
String warningMsg = "index name ["
45-
+ indexName
46-
+ "] starts with a dot '.', in the next major version, "
47-
+ "index names starting with a dot are reserved for hidden indices and system indices";
48-
49-
List<String> expectedWarnings = List.of(warningMsg);
50-
51-
logger.info("expecting warnings: " + expectedWarnings.toString());
52-
RequestOptions consumeSystemIndicesWarningsOptions = RequestOptions.DEFAULT.toBuilder()
53-
.setWarningsHandler(warnings -> expectedWarnings.equals(warnings) == false)
54-
.build();
55-
56-
request.setOptions(consumeSystemIndicesWarningsOptions);
57-
}
58-
5941
public void testSearchWithoutIndexCreatedIsAllowed() throws Exception {
6042
Request request = new Request("GET", ".fleet-agents/_search");
6143
request.setJsonEntity("{ \"query\": { \"match_all\": {} } }");
@@ -98,7 +80,6 @@ public void testCreationOfFleetActions() throws Exception {
9880

9981
public void testCreationOfFleetFiles() throws Exception {
10082
Request request = new Request("PUT", ".fleet-files-agent-00001");
101-
expectSystemIndexWarning(request, ".fleet-files-agent-00001");
10283
Response response = client().performRequest(request);
10384
assertEquals(200, response.getStatusLine().getStatusCode());
10485

@@ -111,7 +92,6 @@ public void testCreationOfFleetFiles() throws Exception {
11192

11293
public void testCreationOfFleetFileData() throws Exception {
11394
Request request = new Request("PUT", ".fleet-file-data-agent-00001");
114-
expectSystemIndexWarning(request, ".fleet-file-data-agent-00001");
11595
Response response = client().performRequest(request);
11696
assertEquals(200, response.getStatusLine().getStatusCode());
11797

0 commit comments

Comments
 (0)