From 6f166dd0fff5421bb81cd102fc84360fb43e6b9a Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 9 Dec 2015 23:57:14 -0800 Subject: [PATCH] Remove NodeBuilder The NodeBuilder is currently used to construct a Node. However, this is really just yet-another-builder that wraps around a Settings.Builder witha couple convenience methods. But there are very few uses of these convenience methods. This change removes NodeBuilder, in favor of just using the Node constructor. --- .../elasticsearch/bootstrap/Bootstrap.java | 18 +-- .../java/org/elasticsearch/node/Node.java | 2 - .../org/elasticsearch/node/NodeBuilder.java | 152 ------------------ .../org/elasticsearch/node/package-info.java | 4 +- .../org/elasticsearch/tribe/TribeService.java | 3 - .../benchmark/aliases/AliasesBenchmark.java | 9 +- .../breaker/CircuitBreakerBenchmark.java | 3 +- .../get/SimpleGetActionBenchmark.java | 8 +- .../mapping/ManyMappingsBenchmark.java | 13 +- .../percolator/PercolatorStressBenchmark.java | 7 +- .../recovery/ReplicaRecoveryBenchmark.java | 12 +- .../expression/ScriptComparisonBenchmark.java | 2 - .../score/ScriptsConstantScoreBenchmark.java | 1 - .../scripts/score/ScriptsScoreBenchmark.java | 1 - .../ScriptsScorePayloadSumBenchmark.java | 1 - .../search/SuggestSearchBenchMark.java | 3 +- ...CardinalityAggregationSearchBenchmark.java | 11 +- .../aggregations/GlobalOrdinalsBenchmark.java | 16 +- .../HDRPercentilesAggregationBenchmark.java | 12 +- .../HistogramAggregationSearchBenchmark.java | 14 +- ...ludeExcludeAggregationSearchBenchmark.java | 11 +- ...PercentilesAggregationSearchBenchmark.java | 13 +- ...QueryFilterAggregationSearchBenchmark.java | 10 +- ...AggregationSearchCollectModeBenchmark.java | 12 +- ...AggregationSearchAndIndexingBenchmark.java | 8 +- .../TermsAggregationSearchBenchmark.java | 14 +- ...TimeDataHistogramAggregationBenchmark.java | 7 +- .../ChildSearchAndIndexingBenchmark.java | 7 +- .../search/child/ChildSearchBenchmark.java | 21 +-- .../ChildSearchShortCircuitBenchmark.java | 7 +- .../geo/GeoDistanceSearchBenchmark.java | 6 +- .../search/nested/NestedSearchBenchMark.java | 5 +- .../search/scroll/ScrollSearchBenchmark.java | 8 +- .../client/transport/TransportClientIT.java | 7 +- .../threadpool/SimpleThreadPoolIT.java | 15 +- .../java/org/elasticsearch/tribe/TribeIT.java | 7 +- docs/java-api/client.asciidoc | 16 +- .../elasticsearch/tribe/TribeUnitTests.java | 3 +- .../test/ESSingleNodeTestCase.java | 14 +- 39 files changed, 126 insertions(+), 357 deletions(-) delete mode 100644 core/src/main/java/org/elasticsearch/node/NodeBuilder.java diff --git a/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java b/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java index 3a0ddf1c050..053f4aeaf33 100644 --- a/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java +++ b/core/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java @@ -37,7 +37,6 @@ import org.elasticsearch.monitor.jvm.JvmInfo; import org.elasticsearch.monitor.os.OsProbe; import org.elasticsearch.monitor.process.ProcessProbe; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.node.internal.InternalSettingsPreparer; import java.io.ByteArrayOutputStream; @@ -80,11 +79,11 @@ final class Bootstrap { } }); } - + /** initialize native resources */ public static void initializeNatives(Path tmpFile, boolean mlockAll, boolean seccomp, boolean ctrlHandler) { final ESLogger logger = Loggers.getLogger(Bootstrap.class); - + // check if the user is running as root, and bail if (Natives.definitelyRunningAsRoot()) { if (Boolean.parseBoolean(System.getProperty("es.insecure.allow.root"))) { @@ -93,12 +92,12 @@ final class Bootstrap { throw new RuntimeException("don't run elasticsearch as root."); } } - + // enable secure computing mode if (seccomp) { Natives.trySeccomp(tmpFile); } - + // mlockall if requested if (mlockAll) { if (Constants.WINDOWS) { @@ -175,11 +174,10 @@ final class Bootstrap { .put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, true) .build(); - NodeBuilder nodeBuilder = NodeBuilder.nodeBuilder().settings(nodeSettings); - node = nodeBuilder.build(); + node = new Node(nodeSettings); } - - /** + + /** * option for elasticsearch.yml etc to turn off our security manager completely, * for example if you want to have your own configuration or just disable. */ @@ -322,7 +320,7 @@ final class Bootstrap { if (foreground) { Loggers.enableConsoleLogging(); } - + throw e; } } diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 3caff627530..f4bc34a91e2 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -108,8 +108,6 @@ import static org.elasticsearch.common.settings.Settings.settingsBuilder; /** * A node represent a node within a cluster (cluster.name). The {@link #client()} can be used * in order to use a {@link Client} to perform actions/operations against the cluster. - *

In order to create a node, the {@link NodeBuilder} can be used. When done with it, make sure to - * call {@link #close()} on it. */ public class Node implements Releasable { diff --git a/core/src/main/java/org/elasticsearch/node/NodeBuilder.java b/core/src/main/java/org/elasticsearch/node/NodeBuilder.java deleted file mode 100644 index 377c409ccb1..00000000000 --- a/core/src/main/java/org/elasticsearch/node/NodeBuilder.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.node; - -import org.elasticsearch.common.settings.Settings; - -/** - * A node builder is used to construct a {@link Node} instance. - *

- * Settings will be loaded relative to the ES home (with or without config/ prefix) and if not found, - * within the classpath (with or without config/ prefix). The settings file loaded can either be named - * elasticsearch.yml or elasticsearch.json). - *

- * Explicit settings can be passed by using the {@link #settings(org.elasticsearch.common.settings.Settings)} method. - *

- * In any case, settings will be resolved from system properties as well that are either prefixed with es. - * or elasticsearch.. - *

- * An example for creating a simple node with optional settings loaded from the classpath: - *

- * Node node = NodeBuilder.nodeBuilder().node();
- * 
- *

- * An example for creating a node with explicit settings (in this case, a node in the cluster that does not hold - * data): - *

- * Node node = NodeBuilder.nodeBuilder()
- *                      .settings(Settings.settingsBuilder().put("node.data", false)
- *                      .node();
- * 
- *

- * When done with the node, make sure you call {@link Node#close()} on it. - * - * - */ -public class NodeBuilder { - - private final Settings.Builder settings = Settings.settingsBuilder(); - - /** - * A convenient factory method to create a {@link NodeBuilder}. - */ - public static NodeBuilder nodeBuilder() { - return new NodeBuilder(); - } - - /** - * Set addition settings simply by working directly against the settings builder. - */ - public Settings.Builder settings() { - return settings; - } - - /** - * Set addition settings simply by working directly against the settings builder. - */ - public Settings.Builder getSettings() { - return settings; - } - - /** - * Explicit node settings to set. - */ - public NodeBuilder settings(Settings.Builder settings) { - return settings(settings.build()); - } - - /** - * Explicit node settings to set. - */ - public NodeBuilder settings(Settings settings) { - this.settings.put(settings); - return this; - } - - /** - * Is the node going to be a client node which means it will hold no data (node.data is - * set to false) and other optimizations by different modules. - * - * @param client Should the node be just a client node or not. - */ - public NodeBuilder client(boolean client) { - settings.put("node.client", client); - return this; - } - - /** - * Is the node going to be allowed to allocate data (shards) to it or not. This setting map to - * the node.data setting. Note, when setting {@link #client(boolean)}, the node will - * not hold any data by default. - * - * @param data Should the node be allocated data to or not. - */ - public NodeBuilder data(boolean data) { - settings.put("node.data", data); - return this; - } - - /** - * Is the node a local node. A local node is a node that uses a local (JVM level) discovery and - * transport. Other (local) nodes started within the same JVM (actually, class-loader) will be - * discovered and communicated with. Nodes outside of the JVM will not be discovered. - * - * @param local Should the node be local or not - */ - public NodeBuilder local(boolean local) { - settings.put("node.local", local); - return this; - } - - /** - * The cluster name this node is part of (maps to the cluster.name setting). Defaults - * to elasticsearch. - * - * @param clusterName The cluster name this node is part of. - */ - public NodeBuilder clusterName(String clusterName) { - settings.put("cluster.name", clusterName); - return this; - } - - /** - * Builds the node without starting it. - */ - public Node build() { - return new Node(settings.build()); - } - - /** - * {@link #build()}s and starts the node. - */ - public Node node() { - return build().start(); - } -} diff --git a/core/src/main/java/org/elasticsearch/node/package-info.java b/core/src/main/java/org/elasticsearch/node/package-info.java index fa503a9ce1b..02538cda4f8 100644 --- a/core/src/main/java/org/elasticsearch/node/package-info.java +++ b/core/src/main/java/org/elasticsearch/node/package-info.java @@ -18,7 +18,7 @@ */ /** - * Allow to build a {@link org.elasticsearch.node.Node} using {@link org.elasticsearch.node.NodeBuilder} which is a + * Allow to build a {@link org.elasticsearch.node.Node} which is a * node within the cluster. */ -package org.elasticsearch.node; \ No newline at end of file +package org.elasticsearch.node; diff --git a/core/src/main/java/org/elasticsearch/tribe/TribeService.java b/core/src/main/java/org/elasticsearch/tribe/TribeService.java index db17d4d44f2..f577415ee6b 100644 --- a/core/src/main/java/org/elasticsearch/tribe/TribeService.java +++ b/core/src/main/java/org/elasticsearch/tribe/TribeService.java @@ -20,7 +20,6 @@ package org.elasticsearch.tribe; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; - import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterChangedEvent; @@ -46,8 +45,6 @@ import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.discovery.DiscoveryService; import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; -import org.elasticsearch.node.internal.InternalSettingsPreparer; import org.elasticsearch.rest.RestStatus; import java.util.EnumSet; diff --git a/core/src/test/java/org/elasticsearch/benchmark/aliases/AliasesBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/aliases/AliasesBenchmark.java index 7b5d489e45f..397cede7e62 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/aliases/AliasesBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/aliases/AliasesBenchmark.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.IndexAlreadyExistsException; import org.elasticsearch.monitor.jvm.JvmStats; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import java.io.IOException; import java.util.List; @@ -46,13 +45,13 @@ public class AliasesBenchmark { Settings settings = Settings.settingsBuilder() .put("node.master", false).build(); - Node node1 = NodeBuilder.nodeBuilder().settings( - Settings.settingsBuilder().put(settings).put("node.master", true) - ).node(); + Node node1 = new Node( + Settings.settingsBuilder().put(settings).put("node.master", true).build() + ).start(); Node[] otherNodes = new Node[NUM_ADDITIONAL_NODES]; for (int i = 0; i < otherNodes.length; i++) { - otherNodes[i] = NodeBuilder.nodeBuilder().settings(settings).node(); + otherNodes[i] = new Node(settings).start(); } Client client = node1.client(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/breaker/CircuitBreakerBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/breaker/CircuitBreakerBenchmark.java index f6b0497b090..af47b650237 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/breaker/CircuitBreakerBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/breaker/CircuitBreakerBenchmark.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.indices.IndexAlreadyExistsException; import org.elasticsearch.indices.breaker.HierarchyCircuitBreakerService; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import java.util.UUID; @@ -123,7 +122,7 @@ public class CircuitBreakerBenchmark { } public static void main(String args[]) throws Exception { - Node node = NodeBuilder.nodeBuilder().settings(Settings.settingsBuilder()).node(); + Node node = new Node(Settings.EMPTY); final Client client = node.client(); try { try { diff --git a/core/src/test/java/org/elasticsearch/benchmark/get/SimpleGetActionBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/get/SimpleGetActionBenchmark.java index d78df7f6aa8..d7cc86e987c 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/get/SimpleGetActionBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/get/SimpleGetActionBenchmark.java @@ -21,9 +21,9 @@ package org.elasticsearch.benchmark.get; import org.elasticsearch.client.Client; import org.elasticsearch.common.StopWatch; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.SizeValue; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; // simple test for embedded / single remote lookup public class SimpleGetActionBenchmark { @@ -31,11 +31,11 @@ public class SimpleGetActionBenchmark { public static void main(String[] args) { long OPERATIONS = SizeValue.parseSizeValue("300k").singles(); - Node node = NodeBuilder.nodeBuilder().node(); + Node node = new Node(Settings.EMPTY); Client client; if (false) { - client = NodeBuilder.nodeBuilder().client(true).node().client(); + client = new Node(Settings.builder().put("node.client", true).build()).start().client(); } else { client = node.client(); } @@ -52,4 +52,4 @@ public class SimpleGetActionBenchmark { node.close(); } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/elasticsearch/benchmark/mapping/ManyMappingsBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/mapping/ManyMappingsBenchmark.java index ff7d0840a2b..f12bd24ed15 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/mapping/ManyMappingsBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/mapping/ManyMappingsBenchmark.java @@ -33,7 +33,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** */ @@ -92,16 +91,12 @@ public class ManyMappingsBenchmark { .put("") .put(SETTING_NUMBER_OF_SHARDS, 5) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", ManyMappingsBenchmark.class.getSimpleName()) .build(); - String clusterName = ManyMappingsBenchmark.class.getSimpleName(); - Node node = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings)) - .node(); + Node node = new Node(settings).start(); if (TWO_NODES) { - Node node2 = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings)) - .node(); + Node node2 = new Node(settings).start(); } Client client = node.client(); @@ -153,4 +148,4 @@ public class ManyMappingsBenchmark { } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/elasticsearch/benchmark/percolator/PercolatorStressBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/percolator/PercolatorStressBenchmark.java index 81492eb959f..5a40931ea90 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/percolator/PercolatorStressBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/percolator/PercolatorStressBenchmark.java @@ -19,9 +19,9 @@ package org.elasticsearch.benchmark.percolator; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.percolate.PercolateResponse; import org.elasticsearch.client.Client; +import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.common.StopWatch; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -37,7 +37,6 @@ import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.rangeQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -52,10 +51,10 @@ public class PercolatorStressBenchmark { Node[] nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().settings(settingsBuilder().put(settings).put("name", "node" + i)).node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } - Node clientNode = nodeBuilder().settings(settingsBuilder().put(settings).put("name", "client")).client(true).node(); + Node clientNode = new Node(settingsBuilder().put(settings).put("name", "client").put("node.client", true).build()).start(); Client client = clientNode.client(); client.admin().indices().create(createIndexRequest("test")).actionGet(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/recovery/ReplicaRecoveryBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/recovery/ReplicaRecoveryBenchmark.java index b857e4d59ee..180cbae17e4 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/recovery/ReplicaRecoveryBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/recovery/ReplicaRecoveryBenchmark.java @@ -42,7 +42,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -66,12 +65,9 @@ public class ReplicaRecoveryBenchmark { .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) .put(TransportModule.TRANSPORT_TYPE_KEY, "local") + .put("cluster.name", ReplicaRecoveryBenchmark.class.getSimpleName()) .build(); - - String clusterName = ReplicaRecoveryBenchmark.class.getSimpleName(); - Node node1 = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings)) - .node(); + Node node1 = new Node(settings).start(); final ESLogger logger = ESLoggerFactory.getLogger("benchmark"); @@ -100,9 +96,7 @@ public class ReplicaRecoveryBenchmark { logger.info("--> starting another node and allocating a shard on it"); - Node node2 = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings)) - .node(); + Node node2 = new Node(settings).start(); client1.admin().indices().prepareUpdateSettings(INDEX_NAME).setSettings(IndexMetaData.SETTING_NUMBER_OF_REPLICAS + ": 1").get(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/scripts/expression/ScriptComparisonBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/scripts/expression/ScriptComparisonBenchmark.java index ce4cbf11577..e95f0ce8a33 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/scripts/expression/ScriptComparisonBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/scripts/expression/ScriptComparisonBenchmark.java @@ -38,13 +38,11 @@ import org.elasticsearch.search.sort.ScriptSortBuilder; import org.elasticsearch.search.sort.SortBuilders; import org.joda.time.PeriodType; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Random; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; public class ScriptComparisonBenchmark { diff --git a/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsConstantScoreBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsConstantScoreBenchmark.java index 53baf78d4c1..4c0afbe9a39 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsConstantScoreBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsConstantScoreBenchmark.java @@ -35,7 +35,6 @@ import java.util.List; import java.util.Map.Entry; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * diff --git a/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScoreBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScoreBenchmark.java index 53c34a2c88e..12ff33ee25e 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScoreBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScoreBenchmark.java @@ -34,7 +34,6 @@ import java.util.List; import java.util.Map.Entry; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * diff --git a/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScorePayloadSumBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScorePayloadSumBenchmark.java index b80919290c5..869c3469266 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScorePayloadSumBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/scripts/score/ScriptsScorePayloadSumBenchmark.java @@ -35,7 +35,6 @@ import java.util.List; import java.util.Map.Entry; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java b/core/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java index d78a478b190..cab05f50575 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/SuggestSearchBenchMark.java @@ -45,7 +45,6 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; import static org.elasticsearch.index.query.QueryBuilders.prefixQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** */ @@ -61,7 +60,7 @@ public class SuggestSearchBenchMark { Node[] nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().settings(settingsBuilder().put(settings).put("name", "node" + i)).node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } Client client = nodes[0].client(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/CardinalityAggregationSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/CardinalityAggregationSearchBenchmark.java index 40e278159c5..8bc470b57a9 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/CardinalityAggregationSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/CardinalityAggregationSearchBenchmark.java @@ -39,7 +39,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.search.aggregations.AggregationBuilders.cardinality; public class CardinalityAggregationSearchBenchmark { @@ -59,19 +58,15 @@ public class CardinalityAggregationSearchBenchmark { .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 5) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", CLUSTER_NAME) .build(); Node[] nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().clusterName(CLUSTER_NAME) - .settings(settingsBuilder().put(settings).put("name", "node" + i)) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } - Node clientNode = nodeBuilder() - .clusterName(CLUSTER_NAME) - .settings(settingsBuilder().put(settings).put("name", "client")).client(true).node(); - + Node clientNode = new Node(settingsBuilder().put(settings).put("name", "client").put("node.client", true).build()).start(); Client client = clientNode.client(); try { diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/GlobalOrdinalsBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/GlobalOrdinalsBenchmark.java index ed94397068e..2508e43773b 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/GlobalOrdinalsBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/GlobalOrdinalsBenchmark.java @@ -21,7 +21,6 @@ package org.elasticsearch.benchmark.search.aggregations; import com.carrotsearch.hppc.IntIntHashMap; import com.carrotsearch.hppc.ObjectHashSet; import com.carrotsearch.randomizedtesting.generators.RandomStrings; - import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; @@ -40,14 +39,18 @@ import org.elasticsearch.node.Node; import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.transport.TransportModule; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Random; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -77,13 +80,10 @@ public class GlobalOrdinalsBenchmark { .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) .put(TransportModule.TRANSPORT_TYPE_KEY, "local") + .put("cluster.name", GlobalOrdinalsBenchmark.class.getSimpleName()) .build(); - String clusterName = GlobalOrdinalsBenchmark.class.getSimpleName(); - node = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings)) - .node(); - + node = new Node(settings).start(); client = node.client(); try { diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/HDRPercentilesAggregationBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/HDRPercentilesAggregationBenchmark.java index af0eee65f08..e55c6c70844 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/HDRPercentilesAggregationBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/HDRPercentilesAggregationBenchmark.java @@ -20,7 +20,6 @@ package org.elasticsearch.benchmark.search.aggregations; import com.carrotsearch.randomizedtesting.generators.RandomInts; - import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.bulk.BulkResponse; @@ -42,7 +41,6 @@ import java.util.concurrent.TimeUnit; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.search.aggregations.AggregationBuilders.percentiles; public class HDRPercentilesAggregationBenchmark { @@ -68,19 +66,15 @@ public class HDRPercentilesAggregationBenchmark { .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 5) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", CLUSTER_NAME) .build(); Node[] nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().clusterName(CLUSTER_NAME) - .settings(settingsBuilder().put(settings).put("name", "node" + i)) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } - Node clientNode = nodeBuilder() - .clusterName(CLUSTER_NAME) - .settings(settingsBuilder().put(settings).put("name", "client")).client(true).node(); - + Node clientNode = new Node(settingsBuilder().put(settings).put("name", "client").put("node.client", true).build()).start(); Client client = clientNode.client(); try { diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/HistogramAggregationSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/HistogramAggregationSearchBenchmark.java index d54c2959bce..0944a0c36ec 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/HistogramAggregationSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/HistogramAggregationSearchBenchmark.java @@ -39,8 +39,9 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; -import static org.elasticsearch.search.aggregations.AggregationBuilders.*; +import static org.elasticsearch.search.aggregations.AggregationBuilders.dateHistogram; +import static org.elasticsearch.search.aggregations.AggregationBuilders.histogram; +import static org.elasticsearch.search.aggregations.AggregationBuilders.stats; /** * @@ -58,15 +59,12 @@ public class HistogramAggregationSearchBenchmark { .put("refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", HistogramAggregationSearchBenchmark.class.getSimpleName()) .build(); - String clusterName = HistogramAggregationSearchBenchmark.class.getSimpleName(); - Node node1 = nodeBuilder() - .clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("name", "node1")).node(); - - //Node clientNode = nodeBuilder().clusterName(clusterName).settings(settingsBuilder().put(settings).put("name", "client")).client(true).node(); + Node node1 = new Node(settingsBuilder().put(settings).put("name", "node1").build()).start(); + //Node clientNode = new Node(settingsBuilder().put(settings).put("name", "client").put("node.client", true).build()).start(); Client client = node1.client(); long[] lValues = new long[NUMBER_OF_TERMS]; diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/IncludeExcludeAggregationSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/IncludeExcludeAggregationSearchBenchmark.java index 1bf8a33c095..26397bfa2ea 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/IncludeExcludeAggregationSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/IncludeExcludeAggregationSearchBenchmark.java @@ -39,7 +39,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.search.aggregations.AggregationBuilders.terms; public class IncludeExcludeAggregationSearchBenchmark { @@ -57,19 +56,15 @@ public class IncludeExcludeAggregationSearchBenchmark { .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", CLUSTER_NAME) .build(); Node[] nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().clusterName(CLUSTER_NAME) - .settings(settingsBuilder().put(settings).put("name", "node" + i)) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } - Node clientNode = nodeBuilder() - .clusterName(CLUSTER_NAME) - .settings(settingsBuilder().put(settings).put("name", "client")).client(true).node(); - + Node clientNode = new Node(settingsBuilder().put(settings).put("name", "client").put("node.client", true).build()).start(); Client client = clientNode.client(); try { diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/PercentilesAggregationSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/PercentilesAggregationSearchBenchmark.java index 1d5bebef295..3e127a20e6c 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/PercentilesAggregationSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/PercentilesAggregationSearchBenchmark.java @@ -49,7 +49,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.elasticsearch.search.aggregations.AggregationBuilders.percentiles; public class PercentilesAggregationSearchBenchmark { @@ -106,19 +105,15 @@ public class PercentilesAggregationSearchBenchmark { .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 100) // to also test performance and accuracy of the reduce phase .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", CLUSTER_NAME) .build(); Node[] nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().clusterName(CLUSTER_NAME) - .settings(settingsBuilder().put(settings).put("name", "node" + i)) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } - Node clientNode = nodeBuilder() - .clusterName(CLUSTER_NAME) - .settings(settingsBuilder().put(settings).put("name", "client")).client(true).node(); - + Node clientNode = new Node(settingsBuilder().put(settings).put("name", "client").put("node.client", true).build()).start(); Client client = clientNode.client(); for (Distribution d : Distribution.values()) { @@ -193,7 +188,7 @@ public class PercentilesAggregationSearchBenchmark { System.out.println("Sum of error squares: " + sumOfErrorSquares); System.out.println(); } - + System.out.println("## Performance"); for (int i = 0; i < 3; ++i) { for (Distribution d : Distribution.values()) { diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/QueryFilterAggregationSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/QueryFilterAggregationSearchBenchmark.java index 7dd0167eabb..c179a9a9193 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/QueryFilterAggregationSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/QueryFilterAggregationSearchBenchmark.java @@ -42,7 +42,6 @@ import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; public class QueryFilterAggregationSearchBenchmark { @@ -58,12 +57,11 @@ public class QueryFilterAggregationSearchBenchmark { .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 2) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("name", "node1") + .put("cluster.name", QueryFilterAggregationSearchBenchmark.class.getSimpleName()) .build(); - String clusterName = QueryFilterAggregationSearchBenchmark.class.getSimpleName(); - Node node1 = nodeBuilder() - .clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("name", "node1")).node(); + Node node1 = new Node(settings).start(); client = node1.client(); long[] lValues = new long[NUMBER_OF_TERMS]; @@ -119,7 +117,7 @@ public class QueryFilterAggregationSearchBenchmark { System.out.println("--> Number of docs in index: " + COUNT); final long anyValue = ((Number) client.prepareSearch().execute().actionGet().getHits().hits()[0].sourceAsMap().get("l_value")).longValue(); - + long totalQueryTime = 0; totalQueryTime = 0; diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/SubAggregationSearchCollectModeBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/SubAggregationSearchCollectModeBenchmark.java index e58787e6c9b..a7f4c64b3f8 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/SubAggregationSearchCollectModeBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/SubAggregationSearchCollectModeBenchmark.java @@ -51,7 +51,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -77,20 +76,15 @@ public class SubAggregationSearchCollectModeBenchmark { .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", SubAggregationSearchCollectModeBenchmark.class.getSimpleName()) .build(); - String clusterName = SubAggregationSearchCollectModeBenchmark.class.getSimpleName(); nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("name", "node" + i)) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } - Node clientNode = nodeBuilder() - .clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("name", "client")).client(true).node(); - + Node clientNode = new Node(settingsBuilder().put(settings).put("name", "client").put("node.client", true).build()).start(); client = clientNode.client(); Thread.sleep(10000); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchAndIndexingBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchAndIndexingBenchmark.java index 9b544a7e866..656e67127e0 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchAndIndexingBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchAndIndexingBenchmark.java @@ -20,7 +20,6 @@ package org.elasticsearch.benchmark.search.aggregations; import com.carrotsearch.hppc.ObjectScatterSet; import com.carrotsearch.randomizedtesting.generators.RandomStrings; - import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; @@ -52,7 +51,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -77,14 +75,12 @@ public class TermsAggregationSearchAndIndexingBenchmark { .put("refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", TermsAggregationSearchAndIndexingBenchmark.class.getSimpleName()) .build(); - String clusterName = TermsAggregationSearchAndIndexingBenchmark.class.getSimpleName(); nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().settings(settingsBuilder().put(settings).put("name", "node1")) - .clusterName(clusterName) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } Client client = nodes[0].client(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchBenchmark.java index e63fbfee43a..2f13557fa04 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TermsAggregationSearchBenchmark.java @@ -52,7 +52,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -105,22 +104,15 @@ public class TermsAggregationSearchBenchmark { .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", TermsAggregationSearchBenchmark.class.getSimpleName()) .build(); - String clusterName = TermsAggregationSearchBenchmark.class.getSimpleName(); nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("path.home", ".")) - .settings(settingsBuilder().put(settings).put("name", "node" + i)) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).put("path.home", ".").build()).start(); } - Node clientNode = nodeBuilder() - .clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("name", "client")) - .settings(settingsBuilder().put(settings).put("path.home", ".")).client(true).node(); - + Node clientNode = new Node(settingsBuilder().put(settings).put("name", "client").put("node.client", true).build()).start(); client = clientNode.client(); Thread.sleep(10000); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TimeDataHistogramAggregationBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TimeDataHistogramAggregationBenchmark.java index 0e16b079b17..72229b87372 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TimeDataHistogramAggregationBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/aggregations/TimeDataHistogramAggregationBenchmark.java @@ -55,7 +55,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -80,14 +79,12 @@ public class TimeDataHistogramAggregationBenchmark { .put("node.local", true) .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", TimeDataHistogramAggregationBenchmark.class.getSimpleName()) .build(); - String clusterName = TimeDataHistogramAggregationBenchmark.class.getSimpleName(); Node[] nodes = new Node[1]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("name", "node" + i)) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } client = nodes[0].client(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchAndIndexingBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchAndIndexingBenchmark.java index ffc7eb91666..20cddddbedd 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchAndIndexingBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchAndIndexingBenchmark.java @@ -40,7 +40,6 @@ import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.hasChildQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.termQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -59,12 +58,10 @@ public class ChildSearchAndIndexingBenchmark { .put("refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", ChildSearchAndIndexingBenchmark.class.getSimpleName()) .build(); - String clusterName = ChildSearchAndIndexingBenchmark.class.getSimpleName(); - Node node1 = nodeBuilder().settings(settingsBuilder().put(settings).put("name", "node1")) - .clusterName(clusterName) - .node(); + Node node1 = new Node(settingsBuilder().put(settings).put("name", "node1").build()).start(); Client client = node1.client(); client.admin().cluster().prepareHealth(indexName).setWaitForGreenStatus().setTimeout("10s").execute().actionGet(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java index 8889801d023..6791fd25dd6 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchBenchmark.java @@ -38,8 +38,12 @@ import static org.elasticsearch.client.Requests.createIndexRequest; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.index.query.QueryBuilders.*; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; +import static org.elasticsearch.index.query.QueryBuilders.boolQuery; +import static org.elasticsearch.index.query.QueryBuilders.hasChildQuery; +import static org.elasticsearch.index.query.QueryBuilders.hasParentQuery; +import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; +import static org.elasticsearch.index.query.QueryBuilders.matchQuery; +import static org.elasticsearch.index.query.QueryBuilders.termQuery; /** * @@ -70,16 +74,15 @@ public class ChildSearchBenchmark { Settings.Builder settings = settingsBuilder() .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 1) - .put(SETTING_NUMBER_OF_REPLICAS, 0); + .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", ChildSearchBenchmark.class.getSimpleName()); // enable bwc parent child mode: if (bwcMode) { settings.put("tests.mock.version", Version.V_1_6_0); } - String clusterName = ChildSearchBenchmark.class.getSimpleName(); - Node node1 = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings.build()).put("name", "node1")).node(); + Node node1 = new Node(settingsBuilder().put(settings).put("name", "node1").build()).start(); Client client = node1.client(); int CHILD_COUNT = 15; @@ -126,7 +129,7 @@ public class ChildSearchBenchmark { .setJvm(true).execute().actionGet(); System.out.println("--> Committed heap size: " + statsResponse.getNodes()[0].getJvm().getMem().getHeapCommitted()); System.out.println("--> Used heap size: " + statsResponse.getNodes()[0].getJvm().getMem().getHeapUsed()); - + // run parent child constant query for (int j = 0; j < QUERY_WARMUP; j++) { SearchResponse searchResponse = client.prepareSearch(indexName) @@ -294,7 +297,7 @@ public class ChildSearchBenchmark { totalQueryTime += searchResponse.getTookInMillis(); } System.out.println("--> has_child Query Avg: " + (totalQueryTime / QUERY_COUNT) + "ms"); - + totalQueryTime = 0; for (int j = 0; j < QUERY_COUNT; j++) { SearchResponse searchResponse = client.prepareSearch(indexName).setQuery(hasChildQuery("child", matchAllQuery()).scoreMode(ScoreMode.Max)).execute().actionGet(); @@ -304,7 +307,7 @@ public class ChildSearchBenchmark { totalQueryTime += searchResponse.getTookInMillis(); } System.out.println("--> has_child query with match_all Query Avg: " + (totalQueryTime / QUERY_COUNT) + "ms"); - + System.out.println("--> Running has_parent query with score type"); // run parent child score query for (int j = 0; j < QUERY_WARMUP; j++) { diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchShortCircuitBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchShortCircuitBenchmark.java index 0db0303ba0c..c711e29b2d5 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchShortCircuitBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/child/ChildSearchShortCircuitBenchmark.java @@ -45,7 +45,6 @@ import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.hasChildQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import static org.elasticsearch.index.query.QueryBuilders.matchQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** * @@ -57,12 +56,10 @@ public class ChildSearchShortCircuitBenchmark { .put("index.refresh_interval", "-1") .put(SETTING_NUMBER_OF_SHARDS, 1) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", ChildSearchShortCircuitBenchmark.class.getSimpleName()) .build(); - String clusterName = ChildSearchShortCircuitBenchmark.class.getSimpleName(); - Node node1 = nodeBuilder().clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("name", "node1")) - .node(); + Node node1 = new Node(settingsBuilder().put(settings).put("name", "node1").build()).start(); Client client = node1.client(); long PARENT_COUNT = SizeValue.parseSizeValue("10M").singles(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/geo/GeoDistanceSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/geo/GeoDistanceSearchBenchmark.java index 55c29180759..26c129f7925 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/geo/GeoDistanceSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/geo/GeoDistanceSearchBenchmark.java @@ -28,11 +28,10 @@ import org.elasticsearch.common.unit.SizeValue; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.index.query.QueryBuilders.geoDistanceQuery; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; +import static org.elasticsearch.index.query.QueryBuilders.geoDistanceQuery; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; /** @@ -41,7 +40,8 @@ public class GeoDistanceSearchBenchmark { public static void main(String[] args) throws Exception { - Node node = NodeBuilder.nodeBuilder().clusterName(GeoDistanceSearchBenchmark.class.getSimpleName()).node(); + Settings settings = Settings.builder().put("cluste.name", GeoDistanceSearchBenchmark.class.getSimpleName()).build(); + Node node = new Node(settings).start(); Client client = node.client(); ClusterHealthResponse clusterHealthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java b/core/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java index 1aa3310924c..e47f918f739 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/nested/NestedSearchBenchMark.java @@ -39,7 +39,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** */ @@ -52,9 +51,7 @@ public class NestedSearchBenchMark { .put(SETTING_NUMBER_OF_REPLICAS, 0) .build(); - Node node1 = nodeBuilder() - .settings(settingsBuilder().put(settings).put("name", "node1")) - .node(); + Node node1 = new Node(settingsBuilder().put(settings).put("name", "node1").build()).start(); Client client = node1.client(); int count = (int) SizeValue.parseSizeValue("1m").singles(); diff --git a/core/src/test/java/org/elasticsearch/benchmark/search/scroll/ScrollSearchBenchmark.java b/core/src/test/java/org/elasticsearch/benchmark/search/scroll/ScrollSearchBenchmark.java index 363facc221a..fed0a30964b 100644 --- a/core/src/test/java/org/elasticsearch/benchmark/search/scroll/ScrollSearchBenchmark.java +++ b/core/src/test/java/org/elasticsearch/benchmark/search/scroll/ScrollSearchBenchmark.java @@ -36,7 +36,6 @@ import java.util.Locale; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; /** */ @@ -46,21 +45,18 @@ public class ScrollSearchBenchmark { public static void main(String[] args) { String indexName = "test"; String typeName = "type"; - String clusterName = ScrollSearchBenchmark.class.getSimpleName(); long numDocs = SizeValue.parseSizeValue("300k").singles(); int requestSize = 50; Settings settings = settingsBuilder() .put(SETTING_NUMBER_OF_SHARDS, 3) .put(SETTING_NUMBER_OF_REPLICAS, 0) + .put("cluster.name", ScrollSearchBenchmark.class.getSimpleName()) .build(); Node[] nodes = new Node[3]; for (int i = 0; i < nodes.length; i++) { - nodes[i] = nodeBuilder() - .clusterName(clusterName) - .settings(settingsBuilder().put(settings).put("name", "node" + i)) - .node(); + nodes[i] = new Node(settingsBuilder().put(settings).put("name", "node" + i).build()).start(); } Client client = nodes[0].client(); diff --git a/core/src/test/java/org/elasticsearch/client/transport/TransportClientIT.java b/core/src/test/java/org/elasticsearch/client/transport/TransportClientIT.java index 4d824453f07..f01fdffd147 100644 --- a/core/src/test/java/org/elasticsearch/client/transport/TransportClientIT.java +++ b/core/src/test/java/org/elasticsearch/client/transport/TransportClientIT.java @@ -32,7 +32,6 @@ import org.elasticsearch.test.ESIntegTestCase.Scope; import org.elasticsearch.transport.TransportService; import static org.elasticsearch.common.settings.Settings.settingsBuilder; -import static org.elasticsearch.node.NodeBuilder.nodeBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; @@ -51,13 +50,15 @@ public class TransportClientIT extends ESIntegTestCase { public void testNodeVersionIsUpdated() { TransportClient client = (TransportClient) internalCluster().client(); TransportClientNodesService nodeService = client.nodeService(); - Node node = nodeBuilder().data(false).settings(Settings.builder() + Node node = new Node(Settings.builder() .put(internalCluster().getDefaultSettings()) .put("path.home", createTempDir()) .put("node.name", "testNodeVersionIsUpdated") .put("http.enabled", false) + .put("node.data", false) + .put("cluster.name", "foobar") .put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, true) // make sure we get what we set :) - .build()).clusterName("foobar").build(); + .build()); node.start(); try { TransportAddress transportAddress = node.injector().getInstance(TransportService.class).boundAddress().publishAddress(); diff --git a/core/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolIT.java b/core/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolIT.java index 838c2a6d401..60f1bad6089 100644 --- a/core/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolIT.java +++ b/core/src/test/java/org/elasticsearch/threadpool/SimpleThreadPoolIT.java @@ -29,7 +29,7 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.node.NodeBuilder; +import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.ESIntegTestCase.Scope; @@ -46,13 +46,20 @@ import java.lang.management.ThreadMXBean; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.concurrent.*; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.sameInstance; /** */ @@ -185,7 +192,7 @@ public class SimpleThreadPoolIT extends ESIntegTestCase { .put("tribe.t1.plugin.mandatory", "non_existing").build(); try { - NodeBuilder.nodeBuilder().settings(settings).build(); + new Node(settings); fail("The node startup is supposed to fail"); } catch(Throwable t) { //all good diff --git a/core/src/test/java/org/elasticsearch/tribe/TribeIT.java b/core/src/test/java/org/elasticsearch/tribe/TribeIT.java index 19def4093c1..28a3dea118e 100644 --- a/core/src/test/java/org/elasticsearch/tribe/TribeIT.java +++ b/core/src/test/java/org/elasticsearch/tribe/TribeIT.java @@ -21,13 +21,13 @@ package org.elasticsearch.tribe; import org.apache.lucene.util.LuceneTestCase; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; +import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.common.Priority; @@ -37,7 +37,6 @@ import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.discovery.MasterNotDiscoveredException; import org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.InternalTestCluster; import org.elasticsearch.test.NodeConfigurationSource; @@ -143,9 +142,7 @@ public class TribeIT extends ESIntegTestCase { .put("node.name", "tribe_node") // make sure we can identify threads from this node .build(); - tribeNode = NodeBuilder.nodeBuilder() - .settings(merged) - .node(); + tribeNode = new Node(merged).start(); tribeClient = tribeNode.client(); } diff --git a/docs/java-api/client.asciidoc b/docs/java-api/client.asciidoc index cfc45b7bc4b..87aa7291b25 100644 --- a/docs/java-api/client.asciidoc +++ b/docs/java-api/client.asciidoc @@ -37,11 +37,10 @@ that can execute operations against elasticsearch. [source,java] -------------------------------------------------- -import static org.elasticsearch.node.NodeBuilder.*; // on startup -Node node = nodeBuilder().node(); +Node node = new Node(Settings.EMPTY).start(); Client client = node.client(); // on shutdown @@ -86,17 +85,15 @@ it): [source,java] -------------------------------------------------- -import static org.elasticsearch.node.NodeBuilder.*; // on startup // Embedded node clients behave just like standalone nodes, // which means that they will leave the HTTP port open! -Node node = - nodeBuilder() - .settings(Settings.settingsBuilder().put("http.enabled", false)) - .client(true) - .node(); +Node node = new Node(Settings.settingsBuilder() + .put("http.enabled", false) + .put("node.client", true).build()) + .start(); Client client = node.client(); @@ -115,11 +112,10 @@ and form a cluster. [source,java] -------------------------------------------------- -import static org.elasticsearch.node.NodeBuilder.*; // on startup -Node node = nodeBuilder().local(true).node(); +Node node = new Node(Settings.builder().put("node.local", true).build()).start(); Client client = node.client(); // on shutdown diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/tribe/TribeUnitTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/tribe/TribeUnitTests.java index f25bd87db19..66c3d7959f8 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/tribe/TribeUnitTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/tribe/TribeUnitTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.node.internal.InternalSettingsPreparer; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESTestCase; @@ -97,7 +96,7 @@ public class TribeUnitTests extends ESTestCase { .put("tribe.t1.node.mode", NODE_MODE).put("tribe.t2.node.mode", NODE_MODE) .put("path.home", createTempDir()).put(extraSettings).build(); - try (Node node = NodeBuilder.nodeBuilder().settings(settings).node()) { + try (Node node = new Node(settings).start()) { try (Client client = node.client()) { assertBusy(new Runnable() { @Override diff --git a/test-framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java b/test-framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java index 887d5f95be4..287bd121c90 100644 --- a/test-framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java +++ b/test-framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java @@ -19,12 +19,12 @@ package org.elasticsearch.test; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder; import org.elasticsearch.cache.recycler.PageCacheRecycler; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.ClusterName; +import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.node.DiscoveryNode; @@ -38,7 +38,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.IndexService; import org.elasticsearch.indices.IndicesService; import org.elasticsearch.node.Node; -import org.elasticsearch.node.NodeBuilder; import org.elasticsearch.node.internal.InternalSettingsPreparer; import org.elasticsearch.script.ScriptService; import org.elasticsearch.search.internal.SearchContext; @@ -48,7 +47,9 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.lessThanOrEqualTo; /** * A test that keep a singleton node started for all tests that can be used to get @@ -119,7 +120,7 @@ public abstract class ESSingleNodeTestCase extends ESTestCase { } private static Node newNode() { - Node build = NodeBuilder.nodeBuilder().local(true).data(true).settings(Settings.builder() + Node build = new Node(Settings.builder() .put(ClusterName.SETTING, InternalTestCluster.clusterName("single-node-cluster", randomLong())) .put("path.home", createTempDir()) // TODO: use a consistent data path for custom paths @@ -132,8 +133,11 @@ public abstract class ESSingleNodeTestCase extends ESTestCase { .put("script.indexed", "on") .put(EsExecutors.PROCESSORS, 1) // limit the number of threads created .put("http.enabled", false) + .put("node.local", true) + .put("node.data", true) .put(InternalSettingsPreparer.IGNORE_SYSTEM_PROPERTIES_SETTING, true) // make sure we get what we set :) - ).build(); + .build() + ); build.start(); assertThat(DiscoveryNode.localNode(build.settings()), is(true)); return build;