public class ManagedEsClient extends Object implements io.dropwizard.lifecycle.Managed
Client. Depending on the EsConfiguration a Node Client or
a TransportClient a is being created and its lifecycle is managed by Dropwizard.| Constructor and Description |
|---|
ManagedEsClient(org.elasticsearch.client.Client client)
Create a new managed Elasticsearch
Client from the provided Client. |
ManagedEsClient(EsConfiguration config)
Create a new managed Elasticsearch
Client. |
ManagedEsClient(org.elasticsearch.node.Node node)
Create a new managed Elasticsearch
Client from the provided Node. |
| Modifier and Type | Method and Description |
|---|---|
org.elasticsearch.client.Client |
getClient()
Get the managed Elasticsearch
Client instance. |
void |
start()
Starts the Elasticsearch
Node (if appropriate). |
void |
stop()
Stops the Elasticsearch
Client and (if appropriate) Node objects. |
public ManagedEsClient(EsConfiguration config)
Client. If EsConfiguration.nodeClient is true, a
Node Client is being created, otherwise a TransportClient is being created with EsConfiguration.servers
as transport addresses.config - a valid EsConfiguration instancepublic ManagedEsClient(org.elasticsearch.node.Node node)
Client from the provided Node.node - a valid Node instancepublic ManagedEsClient(org.elasticsearch.client.Client client)
Client from the provided Client.client - an initialized Client instancepublic void start()
throws Exception
Node (if appropriate). Called before the service becomes available.start in interface io.dropwizard.lifecycle.ManagedException - if something goes wrong; this will halt the service startup.public void stop()
throws Exception
Client and (if appropriate) Node objects. Called after the service
is no longer accepting requests.stop in interface io.dropwizard.lifecycle.ManagedException - if something goes wrong.public org.elasticsearch.client.Client getClient()
Client instance.Client instanceCopyright © 2016. All rights reserved.