|
10 | 10 | package org.elasticsearch.index; |
11 | 11 |
|
12 | 12 | import org.elasticsearch.cluster.metadata.IndexMetadata; |
| 13 | +import org.elasticsearch.cluster.metadata.IndexMetadataVerifier; |
13 | 14 | import org.elasticsearch.common.settings.AbstractScopedSettings; |
14 | 15 | import org.elasticsearch.common.settings.IndexScopedSettings; |
15 | 16 | import org.elasticsearch.common.settings.Setting; |
16 | 17 | import org.elasticsearch.common.settings.Setting.Property; |
17 | 18 | import org.elasticsearch.common.settings.Settings; |
18 | 19 | import org.elasticsearch.common.unit.ByteSizeValue; |
19 | 20 | import org.elasticsearch.core.TimeValue; |
| 21 | +import org.elasticsearch.index.mapper.MapperMetrics; |
| 22 | +import org.elasticsearch.index.mapper.MapperRegistry; |
20 | 23 | import org.elasticsearch.index.translog.Translog; |
| 24 | +import org.elasticsearch.plugins.MapperPlugin; |
21 | 25 | import org.elasticsearch.test.ESTestCase; |
22 | 26 | import org.elasticsearch.test.index.IndexVersionUtils; |
23 | 27 | import org.hamcrest.Matchers; |
|
39 | 43 | import static org.elasticsearch.index.IndexSettings.STATELESS_MIN_NON_FAST_REFRESH_INTERVAL; |
40 | 44 | import static org.elasticsearch.index.IndexSettings.TIME_SERIES_END_TIME; |
41 | 45 | import static org.elasticsearch.index.IndexSettings.TIME_SERIES_START_TIME; |
| 46 | +import static org.elasticsearch.index.mapper.MapperService.INDEX_MAPPER_DYNAMIC_SETTING; |
42 | 47 | import static org.hamcrest.CoreMatchers.equalTo; |
43 | 48 | import static org.hamcrest.Matchers.is; |
44 | 49 | import static org.hamcrest.core.StringContains.containsString; |
@@ -839,6 +844,35 @@ public void testTimeSeriesTimeBoundary() { |
839 | 844 | assertThat(e.getMessage(), Matchers.containsString("index.time_series.end_time must be larger than index.time_series.start_time")); |
840 | 845 | } |
841 | 846 |
|
| 847 | + public void testIndexMapperDynamic() { |
| 848 | + Settings settings = Settings.builder().put(INDEX_MAPPER_DYNAMIC_SETTING.getKey(), randomBoolean()).build(); |
| 849 | + |
| 850 | + INDEX_MAPPER_DYNAMIC_SETTING.get(settings); |
| 851 | + assertWarnings( |
| 852 | + "[index.mapper.dynamic] setting was deprecated in the previous Elasticsearch release and is removed in this release." |
| 853 | + ); |
| 854 | + |
| 855 | + IndexMetadata idxMetaData = newIndexMeta("test", settings); |
| 856 | + IndexMetadataVerifier indexMetadataVerifier = new IndexMetadataVerifier( |
| 857 | + Settings.EMPTY, |
| 858 | + null, |
| 859 | + xContentRegistry(), |
| 860 | + new MapperRegistry(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), MapperPlugin.NOOP_FIELD_FILTER), |
| 861 | + IndexScopedSettings.DEFAULT_SCOPED_SETTINGS, |
| 862 | + null, |
| 863 | + MapperMetrics.NOOP |
| 864 | + ); |
| 865 | + IndexMetadata verifiedMetaData = indexMetadataVerifier.verifyIndexMetadata( |
| 866 | + idxMetaData, |
| 867 | + IndexVersions.MINIMUM_COMPATIBLE, |
| 868 | + IndexVersions.MINIMUM_READONLY_COMPATIBLE |
| 869 | + ); |
| 870 | + assertEquals(idxMetaData, verifiedMetaData); |
| 871 | + assertWarnings( |
| 872 | + "[index.mapper.dynamic] setting was deprecated in the previous Elasticsearch release and is removed in this release." |
| 873 | + ); |
| 874 | + } |
| 875 | + |
842 | 876 | public void testSame() { |
843 | 877 | final var indexSettingKey = "index.example.setting"; |
844 | 878 | final var archivedSettingKey = "archived.example.setting"; |
|
0 commit comments