From c165e640fc90c83be11c5753fd080ab92af37a16 Mon Sep 17 00:00:00 2001 From: Brian Murphy Date: Thu, 28 Aug 2014 15:26:57 +0100 Subject: [PATCH] Indexed Scripts/Templates : Change the default auto_expand to 0-all This commit changes the auto_expand_replicas setting for the ````.scripts```` index to 0-all from 1-all. --- .../metadata/MetaDataCreateIndexService.java | 2 +- .../script/ScriptIndexSettingsTest.java | 16 +--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java index f1cf6cd51bb..b4c70eaa904 100644 --- a/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java +++ b/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java @@ -342,7 +342,7 @@ public class MetaDataCreateIndexService extends AbstractComponent { } if (request.index().equals(ScriptService.SCRIPT_INDEX)) { indexSettingsBuilder.put(SETTING_NUMBER_OF_REPLICAS, settings.getAsInt(SETTING_NUMBER_OF_REPLICAS, 0)); - indexSettingsBuilder.put(SETTING_AUTO_EXPAND_REPLICAS, "1-all"); + indexSettingsBuilder.put(SETTING_AUTO_EXPAND_REPLICAS, "0-all"); } else { if (indexSettingsBuilder.get(SETTING_NUMBER_OF_REPLICAS) == null) { diff --git a/src/test/java/org/elasticsearch/script/ScriptIndexSettingsTest.java b/src/test/java/org/elasticsearch/script/ScriptIndexSettingsTest.java index c1a44bfef40..db8770a2207 100644 --- a/src/test/java/org/elasticsearch/script/ScriptIndexSettingsTest.java +++ b/src/test/java/org/elasticsearch/script/ScriptIndexSettingsTest.java @@ -18,32 +18,18 @@ */ package org.elasticsearch.script; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; -import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.action.exists.ExistsRequest; -import org.elasticsearch.action.indexedscripts.delete.DeleteIndexedScriptAction; import org.elasticsearch.action.indexedscripts.get.GetIndexedScriptResponse; import org.elasticsearch.action.indexedscripts.put.PutIndexedScriptResponse; import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.junit.Test; -import java.util.Map; -import java.util.Set; - @ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST) public class ScriptIndexSettingsTest extends ElasticsearchIntegrationTest{ @@ -78,7 +64,7 @@ public class ScriptIndexSettingsTest extends ElasticsearchIntegrationTest{ String numberOfReplicas = settingsResponse.getSetting(ScriptService.SCRIPT_INDEX,"index.auto_expand_replicas"); assertEquals("Number of shards should be 1", "1", numberOfShards); - assertEquals("Auto expand replicas should be 1-all", "1-all", numberOfReplicas); + assertEquals("Auto expand replicas should be 0-all", "0-all", numberOfReplicas); } @Test