[ML] Use default number of replicas (elastic/x-pack-elasticsearch#861)

Original commit: elastic/x-pack-elasticsearch@7d3d00d196
This commit is contained in:
David Kyle 2017-03-28 15:50:16 +01:00 committed by GitHub
parent 642bdb6cd9
commit 42e3eb7ba5
2 changed files with 4 additions and 8 deletions

View File

@ -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

View File

@ -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"));
}