File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed
qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 10
10
import org .elasticsearch .Version ;
11
11
import org .elasticsearch .client .Request ;
12
12
import org .elasticsearch .client .Response ;
13
+ import org .elasticsearch .common .Strings ;
14
+ import org .elasticsearch .common .settings .Settings ;
13
15
import org .elasticsearch .common .xcontent .support .XContentMapValues ;
14
16
17
+ import java .io .IOException ;
18
+
15
19
public class MappingIT extends AbstractRollingTestCase {
16
20
/**
17
21
* Create a mapping that explicitly disables the _all field (possible in 6x, see #37429)
@@ -48,4 +52,28 @@ public void testAllFieldDisable6x() throws Exception {
48
52
break ;
49
53
}
50
54
}
55
+
56
+ public void testMapperDynamicIndexSetting () throws IOException {
57
+ assumeTrue ("Setting not removed before 7.0" , UPGRADE_FROM_VERSION .onOrAfter (Version .V_7_0_0 ));
58
+ switch (CLUSTER_TYPE ) {
59
+ case OLD :
60
+ createIndex ("my-index" , Settings .EMPTY );
61
+
62
+ Request request = new Request ("PUT" , "/my-index/_settings" );
63
+ request .setJsonEntity (Strings .toString (Settings .builder ().put ("index.mapper.dynamic" , true ).build ()));
64
+ request .setOptions (
65
+ expectWarnings (
66
+ "[index.mapper.dynamic] setting was deprecated in Elasticsearch and will be removed in a future release! "
67
+ + "See the breaking changes documentation for the next major version."
68
+ )
69
+ );
70
+ assertOK (client ().performRequest (request ));
71
+ break ;
72
+ case MIXED :
73
+ case UPGRADED :
74
+ ensureGreen ("my-index" );
75
+ break ;
76
+ }
77
+ }
78
+
51
79
}
Original file line number Diff line number Diff line change @@ -823,4 +823,20 @@ public void testSoftDeletesDisabledWarning() throws Exception {
823
823
ensureGreen (indexName );
824
824
indexDocs (indexName , randomInt (100 ), randomInt (100 ));
825
825
}
826
+
827
+ protected static void updateIndexSettings (String index , Settings .Builder settings ) throws IOException {
828
+ Request request = new Request ("PUT" , "/" + index + "/_settings" );
829
+ request .setJsonEntity (Strings .toString (settings .build ()));
830
+ if (UPGRADE_FROM_VERSION .before (Version .V_7_17_9 )) {
831
+ // There is a bug (fixed in 7.17.9 and 8.7.0 where deprecation warnings could leak into ClusterApplierService#applyChanges)
832
+ // Below warnings are set (and leaking) from an index in this test case
833
+ request .setOptions (expectVersionSpecificWarnings (v -> {
834
+ v .compatible (
835
+ "[index.mapper.dynamic] setting was deprecated in Elasticsearch and will be removed in a future release! "
836
+ + "See the breaking changes documentation for the next major version."
837
+ );
838
+ }));
839
+ }
840
+ assertOK (client ().performRequest (request ));
841
+ }
826
842
}
You can’t perform that action at this time.
0 commit comments