public class NodeBuilder extends Object
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 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 Node.close()
on it.
Constructor and Description |
---|
NodeBuilder() |
Modifier and Type | Method and Description |
---|---|
Node |
build()
Builds the node without starting it.
|
NodeBuilder |
client(boolean client)
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.
|
NodeBuilder |
clusterName(String clusterName)
The cluster name this node is part of (maps to the cluster.name setting).
|
NodeBuilder |
data(boolean data)
Is the node going to be allowed to allocate data (shards) to it or not.
|
Settings.Builder |
getSettings()
Set addition settings simply by working directly against the settings builder.
|
NodeBuilder |
local(boolean local)
Is the node a local node.
|
Node |
node()
build() s and starts the node. |
static NodeBuilder |
nodeBuilder()
A convenient factory method to create a
NodeBuilder . |
Settings.Builder |
settings()
Set addition settings simply by working directly against the settings builder.
|
NodeBuilder |
settings(Settings.Builder settings)
Explicit node settings to set.
|
NodeBuilder |
settings(Settings settings)
Explicit node settings to set.
|
public static NodeBuilder nodeBuilder()
NodeBuilder
.public Settings.Builder settings()
public Settings.Builder getSettings()
public NodeBuilder settings(Settings.Builder settings)
public NodeBuilder settings(Settings settings)
public NodeBuilder client(boolean client)
client
- Should the node be just a client node or not.public NodeBuilder data(boolean data)
client(boolean)
, the node will
not hold any data by default.data
- Should the node be allocated data to or not.public NodeBuilder local(boolean local)
local
- Should the node be local or notpublic NodeBuilder clusterName(String clusterName)
clusterName
- The cluster name this node is part of.public Node build()
Copyright © 2009–2017. All rights reserved.