From b95d3febda5397d6deca55367d749c421003d221 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Mon, 11 Mar 2019 14:45:56 +0100 Subject: [PATCH] SONAR-11792 drop setting index.mapper.dynamic --- .../org/sonar/server/es/newindex/DefaultIndexSettings.java | 3 +-- .../main/java/org/sonar/server/es/newindex/NewIndex.java | 1 - .../java/org/sonar/server/es/newindex/NewIndexTest.java | 6 ++++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/DefaultIndexSettings.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/DefaultIndexSettings.java index aaf2b2e2d64..4dddc71dd8d 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/DefaultIndexSettings.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/DefaultIndexSettings.java @@ -83,8 +83,7 @@ public class DefaultIndexSettings { public static Settings.Builder defaults() { Settings.Builder builder = Settings.builder() .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) - .put("index.refresh_interval", "30s") - .put("index.mapper.dynamic", false); + .put("index.refresh_interval", "30s"); Arrays.stream(DefaultIndexSettingsElement.values()) .map(DefaultIndexSettingsElement::settings) diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java b/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java index f608b9b3163..43ce95471de 100644 --- a/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java +++ b/server/sonar-server-common/src/main/java/org/sonar/server/es/newindex/NewIndex.java @@ -55,7 +55,6 @@ public abstract class NewIndex> { } private void applySettingsConfiguration(SettingsConfiguration settingsConfiguration) { - settings.put("index.mapper.dynamic", valueOf(false)); settings.put("index.refresh_interval", refreshInterval(settingsConfiguration)); Configuration config = settingsConfiguration.getConfiguration(); diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java index 960ac565758..4f50be5e81c 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/es/newindex/NewIndexTest.java @@ -68,7 +68,8 @@ public class NewIndexTest { .getSettings().build(); assertThat(underTest.get("index.number_of_shards")).isNotEmpty(); - assertThat(underTest.get("index.mapper.dynamic")).isEqualTo("false"); + // index.mapper.dynamic is deprecated and should not be set anymore + assertThat(underTest.get("index.mapper.dynamic")).isNull(); assertThat(underTest.get("index.refresh_interval")).isEqualTo("30s"); // setting "mapping.single_type" has been dropped in 6.X because multi type indices are not supported anymore assertThat(underTest.get("mapping.single_type")).isNull(); @@ -83,7 +84,8 @@ public class NewIndexTest { Settings underTest = new SimplestNewIndex(IndexType.main(index, "foo"), defaultSettingsConfiguration).getSettings().build(); assertThat(underTest.get("index.number_of_shards")).isNotEmpty(); - assertThat(underTest.get("index.mapper.dynamic")).isEqualTo("false"); + // index.mapper.dynamic is deprecated and should not be set anymore + assertThat(underTest.get("index.mapper.dynamic")).isNull(); assertThat(underTest.get("index.refresh_interval")).isEqualTo("30s"); // setting "mapping.single_type" has been dropped in 6.X because multi type indices are not supported anymore assertThat(underTest.get("mapping.single_type")).isNull(); -- 2.39.5