public abstract class TransportClient extends AbstractClient
addTransportAddress(org.elasticsearch.common.transport.TransportAddress)
.
The transport client important modules used is the NetworkModule
which is
started in client mode (only connects, no bind).
Note that TransportClient
will be deprecated in Elasticsearch 7.0 and removed in Elasticsearch 8.0.
Use the High Level REST Client instead.
Modifier and Type | Class and Description |
---|---|
static interface |
TransportClient.HostFailureListener
Listener that allows to be notified whenever a node failure / disconnect happens
|
Modifier and Type | Field and Description |
---|---|
static Setting<java.lang.Boolean> |
CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME |
static Setting<TimeValue> |
CLIENT_TRANSPORT_NODES_SAMPLER_INTERVAL |
static Setting<TimeValue> |
CLIENT_TRANSPORT_PING_TIMEOUT |
static Setting<java.lang.Boolean> |
CLIENT_TRANSPORT_SNIFF |
static java.lang.String |
CLIENT_TYPE |
deprecationLogger, logger, settings
CLIENT_TYPE_SETTING_S
Modifier | Constructor and Description |
---|---|
|
TransportClient(Settings settings,
java.util.Collection<java.lang.Class<? extends Plugin>> plugins)
Creates a new TransportClient with the given settings and plugins
|
protected |
TransportClient(Settings settings,
Settings defaultSettings,
java.util.Collection<java.lang.Class<? extends Plugin>> plugins,
TransportClient.HostFailureListener hostFailureListener)
Creates a new TransportClient with the given settings, defaults and plugins.
|
Modifier and Type | Method and Description |
---|---|
protected static java.util.Collection<java.lang.Class<? extends Plugin>> |
addPlugins(java.util.Collection<java.lang.Class<? extends Plugin>> collection,
java.lang.Class<? extends Plugin>... plugins) |
protected static java.util.Collection<java.lang.Class<? extends Plugin>> |
addPlugins(java.util.Collection<java.lang.Class<? extends Plugin>> collection,
java.util.Collection<java.lang.Class<? extends Plugin>> plugins) |
TransportClient |
addTransportAddress(TransportAddress transportAddress)
Adds a transport address that will be used to connect to.
|
TransportClient |
addTransportAddresses(TransportAddress... transportAddress)
Adds a list of transport addresses that will be used to connect to.
|
void |
close()
Closes the client.
|
java.util.List<DiscoveryNode> |
connectedNodes()
Returns the current connected transport nodes that this client will use.
|
protected <Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> |
doExecute(Action<Request,Response,RequestBuilder> action,
Request request,
ActionListener<Response> listener) |
java.util.List<DiscoveryNode> |
filteredNodes()
The list of filtered nodes that were not connected to, for example, due to
mismatch in cluster name.
|
java.util.List<DiscoveryNode> |
listedNodes()
Returns the listed nodes in the transport client (ones added to it).
|
TransportClient |
removeTransportAddress(TransportAddress transportAddress)
Removes a transport address from the list of transport addresses that are used to connect to.
|
java.util.List<TransportAddress> |
transportAddresses()
Returns the current registered transport addresses to use (added using
addTransportAddress(org.elasticsearch.common.transport.TransportAddress) . |
admin, bulk, bulk, clearScroll, clearScroll, delete, delete, execute, execute, explain, explain, fieldCaps, fieldCaps, fieldStats, fieldStats, filterWithHeader, get, get, index, index, multiGet, multiGet, multiSearch, multiSearch, multiTermVectors, multiTermVectors, prepareBulk, prepareClearScroll, prepareDelete, prepareDelete, prepareExecute, prepareExplain, prepareFieldCaps, prepareFieldStats, prepareGet, prepareGet, prepareIndex, prepareIndex, prepareIndex, prepareMultiGet, prepareMultiSearch, prepareMultiTermVectors, prepareSearch, prepareSearchScroll, prepareTermVector, prepareTermVector, prepareTermVectors, prepareTermVectors, prepareUpdate, prepareUpdate, search, search, searchScroll, searchScroll, settings, termVector, termVector, termVectors, termVectors, threadPool, update, update
logDeprecatedSetting, logRemovedSetting, nodeName
public static final Setting<TimeValue> CLIENT_TRANSPORT_NODES_SAMPLER_INTERVAL
public static final Setting<java.lang.Boolean> CLIENT_TRANSPORT_IGNORE_CLUSTER_NAME
public static final Setting<java.lang.Boolean> CLIENT_TRANSPORT_SNIFF
public static final java.lang.String CLIENT_TYPE
public TransportClient(Settings settings, java.util.Collection<java.lang.Class<? extends Plugin>> plugins)
protected TransportClient(Settings settings, Settings defaultSettings, java.util.Collection<java.lang.Class<? extends Plugin>> plugins, TransportClient.HostFailureListener hostFailureListener)
settings
- the client settingsdefaultSettings
- default settings that are merged after the plugins have added it's additional settings.plugins
- the client pluginsprotected static java.util.Collection<java.lang.Class<? extends Plugin>> addPlugins(java.util.Collection<java.lang.Class<? extends Plugin>> collection, java.lang.Class<? extends Plugin>... plugins)
protected static java.util.Collection<java.lang.Class<? extends Plugin>> addPlugins(java.util.Collection<java.lang.Class<? extends Plugin>> collection, java.util.Collection<java.lang.Class<? extends Plugin>> plugins)
public java.util.List<TransportAddress> transportAddresses()
addTransportAddress(org.elasticsearch.common.transport.TransportAddress)
.public java.util.List<DiscoveryNode> connectedNodes()
The nodes include all the nodes that are currently alive based on the transport addresses provided.
public java.util.List<DiscoveryNode> filteredNodes()
public java.util.List<DiscoveryNode> listedNodes()
public TransportClient addTransportAddress(TransportAddress transportAddress)
The Node this transport address represents will be used if its possible to connect to it. If it is unavailable, it will be automatically connected to once it is up.
In order to get the list of all the current connected nodes, please see connectedNodes()
.
public TransportClient addTransportAddresses(TransportAddress... transportAddress)
The Node this transport address represents will be used if its possible to connect to it. If it is unavailable, it will be automatically connected to once it is up.
In order to get the list of all the current connected nodes, please see connectedNodes()
.
public TransportClient removeTransportAddress(TransportAddress transportAddress)
public void close()
protected <Request extends ActionRequest,Response extends ActionResponse,RequestBuilder extends ActionRequestBuilder<Request,Response,RequestBuilder>> void doExecute(Action<Request,Response,RequestBuilder> action, Request request, ActionListener<Response> listener)
doExecute
in class AbstractClient