From e735ff49d69951c756db260967cc2527869ed18c Mon Sep 17 00:00:00 2001 From: kimchy Date: Fri, 5 Mar 2010 12:39:38 +0200 Subject: [PATCH] simpler settings builder api --- .../index/store/SimpleStoreBenchmark.java | 6 +-- .../memory/SimpleMemoryMonitorBenchmark.java | 10 ++--- .../elasticsearch/bootstrap/Bootstrap.java | 2 +- .../client/transport/TransportClient.java | 8 ++-- .../cluster/metadata/IndexMetaData.java | 4 +- .../cluster/metadata/MetaDataService.java | 6 +-- .../MoreLikeThisFieldJsonQueryBuilder.java | 3 ++ .../MoreLikeThisFieldJsonQueryParser.java | 4 ++ .../json/MoreLikeThisJsonQueryBuilder.java | 3 ++ .../json/MoreLikeThisJsonQueryParser.java | 4 ++ .../indices/InternalIndicesService.java | 4 +- .../internal/InternalSettingsPerparer.java | 6 +-- .../util/logging/log4j/LogConfigurator.java | 2 +- .../util/settings/ImmutableSettings.java | 39 +++++++++++-------- .../guice/IndexQueryParserModuleTests.java | 4 +- .../netty/benchmark/BenchmarkNettyClient.java | 4 +- .../netty/benchmark/BenchmarkNettyServer.java | 2 +- .../integration/AbstractServersTests.java | 2 +- .../DiscoveryTransportClientTests.java | 2 +- .../TransportClientDocumentActionsTests.java | 4 +- ...ransportClientMoreLikeThisActionTests.java | 4 +- .../datanode/SimpleDataNodesTests.java | 6 +-- .../IndexLifecycleActionTests.java | 12 +++--- 23 files changed, 81 insertions(+), 60 deletions(-) diff --git a/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/index/store/SimpleStoreBenchmark.java b/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/index/store/SimpleStoreBenchmark.java index d17e2f1810c..ed9bd622200 100644 --- a/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/index/store/SimpleStoreBenchmark.java +++ b/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/index/store/SimpleStoreBenchmark.java @@ -278,13 +278,13 @@ public class SimpleStoreBenchmark { store = new MmapFsStore(shardId, settings, environment, localNodeId); } else if (type.equalsIgnoreCase("memory-direct")) { Settings byteBufferSettings = settingsBuilder() - .putAll(settings) - .putBoolean("index.store.bytebuffer.direct", true) + .put(settings) + .put("index.store.bytebuffer.direct", true) .build(); store = new ByteBufferStore(shardId, byteBufferSettings); } else if (type.equalsIgnoreCase("memory-heap")) { Settings memorySettings = settingsBuilder() - .putAll(settings) + .put(settings) .build(); store = new HeapStore(shardId, memorySettings); } else { diff --git a/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/monitor/memory/SimpleMemoryMonitorBenchmark.java b/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/monitor/memory/SimpleMemoryMonitorBenchmark.java index ded387f011d..e698be47923 100644 --- a/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/monitor/memory/SimpleMemoryMonitorBenchmark.java +++ b/modules/benchmark/micro/src/main/java/org/elasticsearch/benchmark/monitor/memory/SimpleMemoryMonitorBenchmark.java @@ -42,13 +42,13 @@ public class SimpleMemoryMonitorBenchmark { Random random = new Random(); Settings settings = settingsBuilder() - .putTime("cluster.routing.schedule", 200, TimeUnit.MILLISECONDS) - .putInt(SETTING_NUMBER_OF_SHARDS, 5) - .putInt(SETTING_NUMBER_OF_REPLICAS, 1) + .put("cluster.routing.schedule", 200, TimeUnit.MILLISECONDS) + .put(SETTING_NUMBER_OF_SHARDS, 5) + .put(SETTING_NUMBER_OF_REPLICAS, 1) .build(); - Server server1 = serverBuilder().settings(settingsBuilder().putAll(settings).put("name", "server1")).server(); - Server server2 = serverBuilder().settings(settingsBuilder().putAll(settings).put("name", "server2")).server(); + Server server1 = serverBuilder().settings(settingsBuilder().put(settings).put("name", "server1")).server(); + Server server2 = serverBuilder().settings(settingsBuilder().put(settings).put("name", "server2")).server(); Client client1 = server1.client(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java b/modules/elasticsearch/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java index bff8995a868..82d45809326 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java @@ -68,7 +68,7 @@ public class Bootstrap { if (tuple.v1().get(JmxService.SettingsConstants.CREATE_CONNECTOR) == null) { // automatically create the connector if we are bootstrapping - Settings updated = settingsBuilder().putAll(tuple.v1()).putBoolean(JmxService.SettingsConstants.CREATE_CONNECTOR, true).build(); + Settings updated = settingsBuilder().put(tuple.v1()).put(JmxService.SettingsConstants.CREATE_CONNECTOR, true).build(); tuple = new Tuple(updated, tuple.v2()); } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java index 4487e6e586c..98e211f88ef 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/client/transport/TransportClient.java @@ -74,7 +74,7 @@ import static org.elasticsearch.util.settings.ImmutableSettings.*; *

The transport client important modules used is the {@link org.elasticsearch.transport.TransportModule} which is * started in client mode (only connects, no bind). * - * @author kimchy (Shay Banon) + * @author kimchy (shay.banon) */ public class TransportClient implements Client { @@ -117,9 +117,9 @@ public class TransportClient implements Client { */ public TransportClient(Settings pSettings, boolean loadConfigSettings) throws ElasticSearchException { Tuple tuple = InternalSettingsPerparer.prepareSettings(pSettings, loadConfigSettings); - this.settings = settingsBuilder().putAll(tuple.v1()) - .putBoolean("network.server", false) - .putBoolean("discovery.client", true) + this.settings = settingsBuilder().put(tuple.v1()) + .put("network.server", false) + .put("discovery.client", true) .build(); this.environment = tuple.v2(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java index 494d3519266..ae737b20870 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/IndexMetaData.java @@ -120,7 +120,7 @@ public class IndexMetaData { } public Builder numberOfShards(int numberOfShards) { - settings = settingsBuilder().putAll(settings).putInt(SETTING_NUMBER_OF_SHARDS, numberOfShards).build(); + settings = settingsBuilder().put(settings).put(SETTING_NUMBER_OF_SHARDS, numberOfShards).build(); return this; } @@ -129,7 +129,7 @@ public class IndexMetaData { } public Builder numberOfReplicas(int numberOfReplicas) { - settings = settingsBuilder().putAll(settings).putInt(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas).build(); + settings = settingsBuilder().put(settings).put(SETTING_NUMBER_OF_REPLICAS, numberOfReplicas).build(); return this; } diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataService.java index 8c151372780..acaef86a372 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaDataService.java @@ -129,12 +129,12 @@ public class MetaDataService extends AbstractComponent { for (IndexRoutingTable indexRoutingTable : currentState.routingTable().indicesRouting().values()) { routingTableBuilder.add(indexRoutingTable); } - ImmutableSettings.Builder indexSettingsBuilder = settingsBuilder().putAll(indexSettings); + ImmutableSettings.Builder indexSettingsBuilder = settingsBuilder().put(indexSettings); if (indexSettings.get(SETTING_NUMBER_OF_SHARDS) == null) { - indexSettingsBuilder.putInt(SETTING_NUMBER_OF_SHARDS, settings.getAsInt(SETTING_NUMBER_OF_SHARDS, 5)); + indexSettingsBuilder.put(SETTING_NUMBER_OF_SHARDS, settings.getAsInt(SETTING_NUMBER_OF_SHARDS, 5)); } if (indexSettings.get(SETTING_NUMBER_OF_REPLICAS) == null) { - indexSettingsBuilder.putInt(SETTING_NUMBER_OF_REPLICAS, settings.getAsInt(SETTING_NUMBER_OF_REPLICAS, 1)); + indexSettingsBuilder.put(SETTING_NUMBER_OF_REPLICAS, settings.getAsInt(SETTING_NUMBER_OF_REPLICAS, 1)); } Settings actualIndexSettings = indexSettingsBuilder.build(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryBuilder.java index 34ddbe29560..48d535e6b09 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryBuilder.java @@ -62,6 +62,9 @@ public class MoreLikeThisFieldJsonQueryBuilder extends BaseJsonQueryBuilder { return this; } + /** + * The percentage of terms to match. Defaults to 0.3. + */ public MoreLikeThisFieldJsonQueryBuilder percentTermsToMatch(float percentTermsToMatch) { this.percentTermsToMatch = percentTermsToMatch; return this; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryParser.java index a52445ad3b0..c11a0ea56e9 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryParser.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisFieldJsonQueryParser.java @@ -90,10 +90,14 @@ public class MoreLikeThisFieldJsonQueryParser extends AbstractIndexComponent imp mltQuery.setBoostTerms(jp.getIntValue() != 0); } else if ("boostTermsFactor".equals(currentFieldName)) { mltQuery.setBoostTermsFactor(jp.getIntValue()); + } else if ("percentTermsToMatch".equals(currentFieldName)) { + mltQuery.setPercentTermsToMatch(jp.getIntValue()); } } else if (token == JsonToken.VALUE_NUMBER_FLOAT) { if ("boostTermsFactor".equals(currentFieldName)) { mltQuery.setBoostTermsFactor(jp.getFloatValue()); + } else if ("percentTermsToMatch".equals(currentFieldName)) { + mltQuery.setPercentTermsToMatch(jp.getFloatValue()); } } else if (token == JsonToken.START_ARRAY) { if ("stopWords".equals(currentFieldName)) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryBuilder.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryBuilder.java index b32676e4a33..67b340301bf 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryBuilder.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryBuilder.java @@ -63,6 +63,9 @@ public class MoreLikeThisJsonQueryBuilder extends BaseJsonQueryBuilder { return this; } + /** + * The percentage of terms to match. Defaults to 0.3. + */ public MoreLikeThisJsonQueryBuilder percentTermsToMatch(float percentTermsToMatch) { this.percentTermsToMatch = percentTermsToMatch; return this; diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryParser.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryParser.java index 9516d9645aa..2842678c3df 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryParser.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/json/MoreLikeThisJsonQueryParser.java @@ -82,10 +82,14 @@ public class MoreLikeThisJsonQueryParser extends AbstractIndexComponent implemen mltQuery.setBoostTerms(jp.getIntValue() != 0); } else if ("boostTermsFactor".equals(currentFieldName)) { mltQuery.setBoostTermsFactor(jp.getIntValue()); + } else if ("percentTermsToMatch".equals(currentFieldName)) { + mltQuery.setPercentTermsToMatch(jp.getIntValue()); } } else if (token == JsonToken.VALUE_NUMBER_FLOAT) { if ("boostTermsFactor".equals(currentFieldName)) { mltQuery.setBoostTermsFactor(jp.getFloatValue()); + } else if ("percentTermsToMatch".equals(currentFieldName)) { + mltQuery.setPercentTermsToMatch(jp.getFloatValue()); } } else if (token == JsonToken.START_ARRAY) { if ("stopWords".equals(currentFieldName)) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java index fffc532910f..dc41e6c2106 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/indices/InternalIndicesService.java @@ -166,8 +166,8 @@ public class InternalIndicesService extends AbstractComponent implements Indices Settings indexSettings = settingsBuilder() .put("settingsType", "index") - .putAll(this.settings) - .putAll(settings) + .put(this.settings) + .put(settings) .classLoader(settings.getClassLoader()) .globalSettings(settings.getGlobalSettings()) .build(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/server/internal/InternalSettingsPerparer.java b/modules/elasticsearch/src/main/java/org/elasticsearch/server/internal/InternalSettingsPerparer.java index a5a78ccafc1..1376e0cfce0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/server/internal/InternalSettingsPerparer.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/server/internal/InternalSettingsPerparer.java @@ -38,7 +38,7 @@ public class InternalSettingsPerparer { public static Tuple prepareSettings(Settings pSettings, boolean loadConfigSettings) { // just create enough settings to build the environment ImmutableSettings.Builder settingsBuilder = settingsBuilder() - .putAll(pSettings) + .put(pSettings) .putProperties("elasticsearch.", System.getProperties()) .putProperties("es.", System.getProperties()) .replacePropertyPlaceholders(); @@ -46,7 +46,7 @@ public class InternalSettingsPerparer { Environment environment = new Environment(settingsBuilder.build()); // put back the env settings - settingsBuilder = settingsBuilder().putAll(pSettings); + settingsBuilder = settingsBuilder().put(pSettings); settingsBuilder.put("path.home", cleanPath(environment.homeFile().getAbsolutePath())); settingsBuilder.put("path.work", cleanPath(environment.workFile().getAbsolutePath())); settingsBuilder.put("path.workWithCluster", cleanPath(environment.workWithClusterFile().getAbsolutePath())); @@ -78,7 +78,7 @@ public class InternalSettingsPerparer { } } - settingsBuilder.putAll(pSettings) + settingsBuilder.put(pSettings) .putProperties("elasticsearch.", System.getProperties()) .putProperties("es.", System.getProperties()) .replacePropertyPlaceholders(); diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/logging/log4j/LogConfigurator.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/logging/log4j/LogConfigurator.java index e0ced310f1b..06cdaf838a0 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/logging/log4j/LogConfigurator.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/util/logging/log4j/LogConfigurator.java @@ -71,7 +71,7 @@ public class LogConfigurator { } loaded = true; Environment environment = new Environment(settings); - ImmutableSettings.Builder settingsBuilder = settingsBuilder().putAll(settings); + ImmutableSettings.Builder settingsBuilder = settingsBuilder().put(settings); try { settingsBuilder.loadFromUrl(environment.resolveConfig("logging.yml")); } catch (FailedToResolveConfigException e) { diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/util/settings/ImmutableSettings.java b/modules/elasticsearch/src/main/java/org/elasticsearch/util/settings/ImmutableSettings.java index 90b78739abb..08f2361d876 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/util/settings/ImmutableSettings.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/util/settings/ImmutableSettings.java @@ -329,7 +329,7 @@ public class ImmutableSettings implements Settings { * @param clazz The setting class value * @return The builder */ - public Builder putClass(String key, Class clazz) { + public Builder put(String key, Class clazz) { map.put(key, clazz.getName()); return this; } @@ -341,7 +341,7 @@ public class ImmutableSettings implements Settings { * @param value The boolean value * @return The builder */ - public Builder putBoolean(String setting, boolean value) { + public Builder put(String setting, boolean value) { put(setting, String.valueOf(value)); return this; } @@ -353,7 +353,7 @@ public class ImmutableSettings implements Settings { * @param value The int value * @return The builder */ - public Builder putInt(String setting, int value) { + public Builder put(String setting, int value) { put(setting, String.valueOf(value)); return this; } @@ -365,7 +365,7 @@ public class ImmutableSettings implements Settings { * @param value The long value * @return The builder */ - public Builder putLong(String setting, long value) { + public Builder put(String setting, long value) { put(setting, String.valueOf(value)); return this; } @@ -377,12 +377,19 @@ public class ImmutableSettings implements Settings { * @param value The float value * @return The builder */ - public Builder putFloat(String setting, float value) { + public Builder put(String setting, float value) { put(setting, String.valueOf(value)); return this; } - public Builder putDouble(String setting, double value) { + /** + * Sets the setting with the provided setting key and the double value. + * + * @param setting The setting key + * @param value The double value + * @return The builder + */ + public Builder put(String setting, double value) { put(setting, String.valueOf(value)); return this; } @@ -394,8 +401,8 @@ public class ImmutableSettings implements Settings { * @param value The time value * @return The builder */ - public Builder putTime(String setting, long value, TimeUnit timeUnit) { - putLong(setting, timeUnit.toMillis(value)); + public Builder put(String setting, long value, TimeUnit timeUnit) { + put(setting, timeUnit.toMillis(value)); return this; } @@ -406,15 +413,15 @@ public class ImmutableSettings implements Settings { * @param value The size value * @return The builder */ - public Builder putSize(String setting, long value, SizeUnit sizeUnit) { - putLong(setting, sizeUnit.toBytes(value)); + public Builder put(String setting, long value, SizeUnit sizeUnit) { + put(setting, sizeUnit.toBytes(value)); return this; } /** * Sets the setting group. */ - public Builder putGroup(String settingPrefix, String groupName, String[] settings, String[] values) throws SettingsException { + public Builder put(String settingPrefix, String groupName, String[] settings, String[] values) throws SettingsException { if (settings.length != values.length) { throw new SettingsException("The settings length must match the value length"); } @@ -430,7 +437,7 @@ public class ImmutableSettings implements Settings { /** * Sets all the provided settings. */ - public Builder putAll(Settings settings) { + public Builder put(Settings settings) { map.putAll(settings.getAsMap()); return this; } @@ -438,7 +445,7 @@ public class ImmutableSettings implements Settings { /** * Sets all the provided settings. */ - public Builder putAll(Map settings) { + public Builder put(Map settings) { map.putAll(settings); return this; } @@ -446,7 +453,7 @@ public class ImmutableSettings implements Settings { /** * Sets all the provided settings. */ - public Builder putAll(Properties properties) { + public Builder put(Properties properties) { for (Map.Entry entry : properties.entrySet()) { map.put((String) entry.getKey(), (String) entry.getValue()); } @@ -461,7 +468,7 @@ public class ImmutableSettings implements Settings { SettingsLoader settingsLoader = SettingsLoaderFactory.loaderFromSource(source); try { Map loadedSettings = settingsLoader.load(source); - putAll(loadedSettings); + put(loadedSettings); } catch (IOException e) { throw new SettingsException("Failed to load settings from [" + source + "]"); } @@ -488,7 +495,7 @@ public class ImmutableSettings implements Settings { SettingsLoader settingsLoader = SettingsLoaderFactory.loaderFromResource(resourceName); try { Map loadedSettings = settingsLoader.load(Streams.copyToString(new InputStreamReader(is, "UTF-8"))); - putAll(loadedSettings); + put(loadedSettings); } catch (IOException e) { throw new SettingsException("Failed to load settings from [" + resourceName + "]"); } diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/index/query/json/guice/IndexQueryParserModuleTests.java b/modules/elasticsearch/src/test/java/org/elasticsearch/index/query/json/guice/IndexQueryParserModuleTests.java index d385d3767fb..4a5c4dec946 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/index/query/json/guice/IndexQueryParserModuleTests.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/index/query/json/guice/IndexQueryParserModuleTests.java @@ -44,9 +44,9 @@ public class IndexQueryParserModuleTests { @Test public void testCustomInjection() { Settings settings = settingsBuilder() - .putClass("index.queryparser.json.query.my.type", MyJsonQueryParser.class) + .put("index.queryparser.json.query.my.type", MyJsonQueryParser.class) .put("index.queryparser.json.query.my.param1", "value1") - .putClass("index.queryparser.json.filter.my.type", MyJsonFilterParser.class) + .put("index.queryparser.json.filter.my.type", MyJsonFilterParser.class) .put("index.queryparser.json.filter.my.param2", "value2") .put("index.cache.filter.type", "none") .build(); diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java index fe4070341c6..03dbeed69c7 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyClient.java @@ -53,8 +53,8 @@ public class BenchmarkNettyClient { final boolean spawn = true; Settings settings = ImmutableSettings.settingsBuilder() - .putBoolean("network.server", false) - .putInt("transport.netty.connectionsPerNode", 5) + .put("network.server", false) + .put("transport.netty.connectionsPerNode", 5) .build(); final ThreadPool threadPool = new CachedThreadPool(); diff --git a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyServer.java b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyServer.java index f9ebc8dd77d..a2159e5042b 100644 --- a/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyServer.java +++ b/modules/elasticsearch/src/test/java/org/elasticsearch/transport/netty/benchmark/BenchmarkNettyServer.java @@ -37,7 +37,7 @@ public class BenchmarkNettyServer { final boolean spawn = true; Settings settings = ImmutableSettings.settingsBuilder() - .putInt("transport.netty.port", 9999) + .put("transport.netty.port", 9999) .build(); final ThreadPool threadPool = new CachedThreadPool(); diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/AbstractServersTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/AbstractServersTests.java index a4909bf6239..856d1b77bf0 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/AbstractServersTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/AbstractServersTests.java @@ -56,7 +56,7 @@ public abstract class AbstractServersTests { String settingsSource = getClass().getName().replace('.', '/') + ".yml"; Settings finalSettings = settingsBuilder() .loadFromClasspath(settingsSource) - .putAll(settings) + .put(settings) .put("name", id) .build(); Server server = serverBuilder() diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/DiscoveryTransportClientTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/DiscoveryTransportClientTests.java index 8180af61237..1d99abd5ff5 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/DiscoveryTransportClientTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/DiscoveryTransportClientTests.java @@ -44,7 +44,7 @@ public class DiscoveryTransportClientTests extends AbstractServersTests { public void testWithDiscovery() throws Exception { startServer("server1"); - client = new TransportClient(ImmutableSettings.settingsBuilder().putBoolean("discovery.enabled", true).build()); + client = new TransportClient(ImmutableSettings.settingsBuilder().put("discovery.enabled", true).build()); // wait a bit so nodes will be discovered Thread.sleep(1000); client.admin().indices().create(createIndexRequest("test")).actionGet(); diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/TransportClientDocumentActionsTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/TransportClientDocumentActionsTests.java index 6312633fbc2..3024592c9f5 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/TransportClientDocumentActionsTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/TransportClientDocumentActionsTests.java @@ -35,14 +35,14 @@ public class TransportClientDocumentActionsTests extends DocumentActionsTests { @Override protected Client getClient1() { TransportAddress server1Address = ((InternalServer) server("server1")).injector().getInstance(TransportService.class).boundAddress().publishAddress(); - TransportClient client = new TransportClient(settingsBuilder().putBoolean("discovery.enabled", false).build()); + TransportClient client = new TransportClient(settingsBuilder().put("discovery.enabled", false).build()); client.addTransportAddress(server1Address); return client; } @Override protected Client getClient2() { TransportAddress server1Address = ((InternalServer) server("server2")).injector().getInstance(TransportService.class).boundAddress().publishAddress(); - TransportClient client = new TransportClient(settingsBuilder().putBoolean("discovery.enabled", false).build()); + TransportClient client = new TransportClient(settingsBuilder().put("discovery.enabled", false).build()); client.addTransportAddress(server1Address); return client; } diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/TransportClientMoreLikeThisActionTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/TransportClientMoreLikeThisActionTests.java index b5b1d20669f..5ea1ab17b7a 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/TransportClientMoreLikeThisActionTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/client/transport/TransportClientMoreLikeThisActionTests.java @@ -35,14 +35,14 @@ public class TransportClientMoreLikeThisActionTests extends MoreLikeThisActionTe @Override protected Client getClient1() { TransportAddress server1Address = ((InternalServer) server("server1")).injector().getInstance(TransportService.class).boundAddress().publishAddress(); - TransportClient client = new TransportClient(settingsBuilder().putBoolean("discovery.enabled", false).build()); + TransportClient client = new TransportClient(settingsBuilder().put("discovery.enabled", false).build()); client.addTransportAddress(server1Address); return client; } @Override protected Client getClient2() { TransportAddress server1Address = ((InternalServer) server("server2")).injector().getInstance(TransportService.class).boundAddress().publishAddress(); - TransportClient client = new TransportClient(settingsBuilder().putBoolean("discovery.enabled", false).build()); + TransportClient client = new TransportClient(settingsBuilder().put("discovery.enabled", false).build()); client.addTransportAddress(server1Address); return client; } diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/datanode/SimpleDataNodesTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/datanode/SimpleDataNodesTests.java index 923b5605480..08e73219e18 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/datanode/SimpleDataNodesTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/datanode/SimpleDataNodesTests.java @@ -42,7 +42,7 @@ public class SimpleDataNodesTests extends AbstractServersTests { } @Test public void testDataNodes() throws Exception { - startServer("nonData1", settingsBuilder().putBoolean("node.data", false).build()); + startServer("nonData1", settingsBuilder().put("node.data", false).build()); client("nonData1").admin().indices().create(createIndexRequest("test")).actionGet(); try { client("nonData1").index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test")).timeout(timeValueSeconds(1))).actionGet(); @@ -51,7 +51,7 @@ public class SimpleDataNodesTests extends AbstractServersTests { // all is well } - startServer("nonData2", settingsBuilder().putBoolean("node.data", false).build()); + startServer("nonData2", settingsBuilder().put("node.data", false).build()); Thread.sleep(500); // still no shard should be allocated @@ -63,7 +63,7 @@ public class SimpleDataNodesTests extends AbstractServersTests { } // now, start a node data, and see that it gets with shards - startServer("data1", settingsBuilder().putBoolean("node.data", true).build()); + startServer("data1", settingsBuilder().put("node.data", true).build()); Thread.sleep(500); IndexResponse indexResponse = client("nonData2").index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java index 30175489b8c..4cc6b50e541 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/indexlifecycle/IndexLifecycleActionTests.java @@ -54,8 +54,8 @@ public class IndexLifecycleActionTests extends AbstractServersTests { @Test public void testIndexLifecycleActionsWith11Shards1Backup() throws Exception { Settings settings = settingsBuilder() - .putInt(SETTING_NUMBER_OF_SHARDS, 11) - .putInt(SETTING_NUMBER_OF_REPLICAS, 1) + .put(SETTING_NUMBER_OF_SHARDS, 11) + .put(SETTING_NUMBER_OF_REPLICAS, 1) .build(); // start one server @@ -189,8 +189,8 @@ public class IndexLifecycleActionTests extends AbstractServersTests { @Test public void testIndexLifecycleActionsWith11Shards0Backup() throws Exception { Settings settings = settingsBuilder() - .putInt(SETTING_NUMBER_OF_SHARDS, 11) - .putInt(SETTING_NUMBER_OF_REPLICAS, 0) + .put(SETTING_NUMBER_OF_SHARDS, 11) + .put(SETTING_NUMBER_OF_REPLICAS, 0) .build(); // start one server @@ -323,8 +323,8 @@ public class IndexLifecycleActionTests extends AbstractServersTests { @Test public void testTwoIndicesCreation() throws Exception { Settings settings = settingsBuilder() - .putInt(SETTING_NUMBER_OF_SHARDS, 11) - .putInt(SETTING_NUMBER_OF_REPLICAS, 0) + .put(SETTING_NUMBER_OF_SHARDS, 11) + .put(SETTING_NUMBER_OF_REPLICAS, 0) .build(); // start one server