use of org.elasticsearch.client.transport.TransportClient in project flink by apache.
the class Elasticsearch2ApiCallBridge method createClient.
@Override
public Client createClient(Map<String, String> clientConfig) {
Settings settings = Settings.settingsBuilder().put(clientConfig).build();
TransportClient transportClient = TransportClient.builder().settings(settings).build();
for (TransportAddress address : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) {
transportClient.addTransportAddress(address);
}
// verify that we actually are connected to a cluster
if (transportClient.connectedNodes().isEmpty()) {
throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!");
}
if (LOG.isInfoEnabled()) {
LOG.info("Created Elasticsearch TransportClient with connected nodes {}", transportClient.connectedNodes());
}
return transportClient;
}
use of org.elasticsearch.client.transport.TransportClient in project storm by apache.
the class StormElasticSearchClient method construct.
public Client construct() {
Settings settings = esConfig.toBasicSettings();
TransportClient transportClient = new TransportClient(settings);
addTransportAddresses(transportClient);
return transportClient;
}
use of org.elasticsearch.client.transport.TransportClient in project elasticsearch by elastic.
the class TransportClientBenchmark method client.
@Override
protected TransportClient client(String benchmarkTargetHost) throws Exception {
TransportClient client = new PreBuiltTransportClient(Settings.EMPTY, NoopPlugin.class);
client.addTransportAddress(new TransportAddress(InetAddress.getByName(benchmarkTargetHost), 9300));
return client;
}
use of org.elasticsearch.client.transport.TransportClient in project wonderdog by infochimps-labs.
the class ElasticSearchStreamingInputFormat method startTransportClient.
//
// == Connecting to Elasticsearch and Querying ==
//
private void startTransportClient(JobConf conf) {
this.client = new TransportClient();
Map<String, String> settings = parsedSettings(conf);
String host = hostname(settings);
if (host.toString().length() == 0) {
System.exit(1);
}
LOG.info("Attempting to connect to Elasticsearch node at " + host + ":9300");
this.client = new TransportClient().addTransportAddress(new InetSocketTransportAddress(host, 9300));
LOG.info("Connected to Elasticsearch cluster");
}
use of org.elasticsearch.client.transport.TransportClient in project wonderdog by infochimps-labs.
the class ElasticSearchStreamingRecordWriter method buildTransportClient.
/**
Build a transport client that will connect to some
Elasticsearch node.
*/
private Client buildTransportClient() {
LOG.info("Connecting transport client to " + transportHost + ":" + Integer.toString(transportPort));
Settings settings = ImmutableSettings.settingsBuilder().put("client.transport.ignore_cluster_name", "true").build();
return new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(transportHost, transportPort));
}
Aggregations