*
* @return injected client or TransportClient
*/
private Client getClient() {
SearchIntoContext ctx = (SearchIntoContext)context;
if (ctx.targetNodes().isEmpty()) {
transportClient = null;
return client;
} else {
ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder();
builder.put("config.ignore_system_properties", true);
builder.put("client.transport.sniff", true);
builder.put("client.transport.ignore_cluster_name", true);
builder.put("client.transport.ignore_cluster_name", true);
transportClient = new TransportClient(builder, false);
for (InetSocketTransportAddress address : ctx.targetNodes()) {
((TransportClient)transportClient).addTransportAddress(address);
}
return transportClient;
}
}