Skip to content

Commit 2226d6c

Browse files
authored
Add _field_names disabling to archival index tests (#117703)
Disabling the "_field_names" field in mappings was possible until 8.x and now issues a deprecation warning. We need to maintain the ability to read these mappings for archival indices so this change adds this case to one of the index mappings in tests and checks for the deprecation warning for it.
1 parent d729558 commit 2226d6c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldMappingsIT.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.Version;
1414
import org.elasticsearch.client.Request;
1515
import org.elasticsearch.client.RequestOptions;
16+
import org.elasticsearch.client.Response;
1617
import org.elasticsearch.client.ResponseException;
1718
import org.elasticsearch.client.RestClient;
1819
import org.elasticsearch.client.WarningsHandler;
@@ -166,7 +167,10 @@ public void setupIndex() throws IOException {
166167
createRestoreRequest.addParameter("wait_for_completion", "true");
167168
createRestoreRequest.setJsonEntity("{\"indices\":\"" + indices.stream().collect(Collectors.joining(",")) + "\"}");
168169
createRestoreRequest.setOptions(RequestOptions.DEFAULT.toBuilder().setWarningsHandler(WarningsHandler.PERMISSIVE));
169-
assertOK(client().performRequest(createRestoreRequest));
170+
Response response = client().performRequest(createRestoreRequest);
171+
// check deprecation warning for "_field_name" disabling
172+
assertTrue(response.getWarnings().stream().filter(s -> s.contains("Disabling _field_names is not necessary")).count() > 0);
173+
assertOK(response);
170174
}
171175

172176
private Request createIndex(String indexName, String file) throws IOException {

x-pack/qa/repository-old-versions/src/test/resources/org/elasticsearch/oldrepos/custom.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"_default_": {
2+
"_field_names": {
3+
"enabled": false
4+
},
25
"properties": {
36
"apache2": {
47
"properties": {

0 commit comments

Comments
 (0)