From 42e3eb7ba5dcb1606c35166940c0d9e79ae33a1c Mon Sep 17 00:00:00 2001 From: David Kyle Date: Tue, 28 Mar 2017 15:50:16 +0100 Subject: [PATCH] [ML] Use default number of replicas (elastic/x-pack-elasticsearch#861) Original commit: elastic/x-pack-elasticsearch@7d3d00d1966865e33da3afb01cd0a1116dfcdb7f --- .../xpack/ml/MachineLearningTemplateRegistry.java | 3 --- .../xpack/ml/MachineLearningTemplateRegistryTests.java | 9 ++++----- 2 files changed, 4 insertions(+), 8 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 2d2e4e09bce..fdb863e9e65 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistry.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistry.java @@ -281,7 +281,6 @@ public class MachineLearningTemplateRegistry extends AbstractComponent implemen */ Settings.Builder mlResultsIndexSettings() { return Settings.builder() - .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-2") .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), delayedNodeTimeOutSetting) // Sacrifice durability for performance: in the event of power // failure we can lose the last 5 seconds of changes, but it's @@ -304,7 +303,6 @@ public class MachineLearningTemplateRegistry extends AbstractComponent implemen // Our indexes are small and one shard puts the // least possible burden on Elasticsearch .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) - .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-2") .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 @@ -319,7 +317,6 @@ public class MachineLearningTemplateRegistry extends AbstractComponent implemen Settings.Builder mlStateIndexSettings() { // TODO review these settings return Settings.builder() - .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-2") .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), delayedNodeTimeOutSetting) // Sacrifice durability for performance: in the event of power // failure we can lose the last 5 seconds of changes, but it's 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 6776f644e59..f8309f70a5d 100644 --- a/plugin/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistryTests.java +++ b/plugin/src/test/java/org/elasticsearch/xpack/ml/MachineLearningTemplateRegistryTests.java @@ -156,8 +156,8 @@ public class MachineLearningTemplateRegistryTests extends ESTestCase { new MachineLearningTemplateRegistry(createSettings(), clusterService, client, threadPool); Settings settings = templateRegistry.mlResultsIndexSettings().build(); + assertEquals(4, settings.size()); assertThat(settings.get("index.number_of_shards"), is(nullValue())); - assertEquals("0-2", settings.get("index.auto_expand_replicas")); assertEquals("async", settings.get("index.translog.durability")); assertEquals("true", settings.get("index.mapper.dynamic")); assertEquals("all_field_values", settings.get("index.query.default_field")); @@ -169,9 +169,8 @@ public class MachineLearningTemplateRegistryTests extends ESTestCase { new MachineLearningTemplateRegistry(createSettings(), clusterService, client, threadPool); Settings settings = templateRegistry.mlNotificationIndexSettings().build(); - assertEquals(4, settings.size()); + assertEquals(3, settings.size()); assertEquals("1", settings.get("index.number_of_shards")); - assertEquals("0-2", settings.get("index.auto_expand_replicas")); assertEquals("true", settings.get("index.mapper.dynamic")); assertEquals("2s", settings.get("index.unassigned.node_left.delayed_timeout")); } @@ -179,10 +178,10 @@ public class MachineLearningTemplateRegistryTests extends ESTestCase { public void testMlStateIndexSettings() { MachineLearningTemplateRegistry templateRegistry = new MachineLearningTemplateRegistry(createSettings(), clusterService, client, threadPool); - Settings settings = templateRegistry.mlResultsIndexSettings().build(); + Settings settings = templateRegistry.mlStateIndexSettings().build(); + assertEquals(2, settings.size()); assertThat(settings.get("index.number_of_shards"), is(nullValue())); - assertEquals("0-2", settings.get("index.auto_expand_replicas")); assertEquals("async", settings.get("index.translog.durability")); assertEquals("2s", settings.get("index.unassigned.node_left.delayed_timeout")); }