From 2e3aca414b0cc8ce987f5ec419402cb05e45eee6 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Tue, 12 Sep 2017 19:25:30 +0100 Subject: [PATCH] [ML] Remove obsolete dynamic mapper setting (elastic/x-pack-elasticsearch#2477) Since 5.6 we have only used one type per ML index, so this setting is not necessary. Original commit: elastic/x-pack-elasticsearch@64c434adecb88936f130f7b6c34014792a043d88 --- .../xpack/ml/MachineLearningTemplateRegistry.java | 9 +-------- .../xpack/ml/MachineLearningTemplateRegistryTests.java | 6 ++---- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistry.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistry.java index 0f830de41ef..2de949f4d95 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistry.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistry.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.index.IndexSettings; -import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.ml.job.persistence.AnomalyDetectorsIndex; import org.elasticsearch.xpack.ml.job.persistence.ElasticsearchMappings; @@ -273,9 +272,6 @@ public class MachineLearningTemplateRegistry extends AbstractComponent implement // failure we can lose the last 5 seconds of changes, but it's // much faster .put(IndexSettings.INDEX_TRANSLOG_DURABILITY_SETTING.getKey(), ASYNC) - // We need to allow fields not mentioned in the mappings to - // pick up default mappings and be used in queries - .put(MapperService.INDEX_MAPPER_DYNAMIC_SETTING.getKey(), true) // set the default all search field .put(IndexSettings.DEFAULT_FIELD_SETTING.getKey(), ElasticsearchMappings.ALL_FIELD_VALUES); } @@ -290,10 +286,7 @@ public class MachineLearningTemplateRegistry extends AbstractComponent implement // Our indexes are small and one shard puts the // least possible burden on Elasticsearch .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) - .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), delayedNodeTimeOutSetting) - // We need to allow fields not mentioned in the mappings to - // pick up default mappings and be used in queries - .put(MapperService.INDEX_MAPPER_DYNAMIC_SETTING.getKey(), true); + .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), delayedNodeTimeOutSetting); } /** diff --git a/plugin/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistryTests.java b/plugin/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistryTests.java index 837cce10faf..6488d150692 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistryTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistryTests.java @@ -149,10 +149,9 @@ public class MachineLearningTemplateRegistryTests extends ESTestCase { new MachineLearningTemplateRegistry(createSettings(), clusterService, client, threadPool); Settings settings = templateRegistry.mlResultsIndexSettings().build(); - assertEquals(4, settings.size()); + assertEquals(3, settings.size()); assertThat(settings.get("index.number_of_shards"), is(nullValue())); assertEquals("async", settings.get("index.translog.durability")); - assertEquals("true", settings.get("index.mapper.dynamic")); assertEquals("all_field_values", settings.get("index.query.default_field")); assertEquals("2s", settings.get("index.unassigned.node_left.delayed_timeout")); } @@ -162,9 +161,8 @@ public class MachineLearningTemplateRegistryTests extends ESTestCase { new MachineLearningTemplateRegistry(createSettings(), clusterService, client, threadPool); Settings settings = templateRegistry.mlNotificationIndexSettings().build(); - assertEquals(3, settings.size()); + assertEquals(2, settings.size()); assertEquals("1", settings.get("index.number_of_shards")); - assertEquals("true", settings.get("index.mapper.dynamic")); assertEquals("2s", settings.get("index.unassigned.node_left.delayed_timeout")); }