Package org.elasticsearch.client.transport

Examples of org.elasticsearch.client.transport.TransportClient.addTransportAddress()


    @Override protected Client getClient2() {
        TransportAddress server2Address = ((InternalNode) node("server2")).injector().getInstance(TransportService.class).boundAddress().publishAddress();
        TransportClient client = new TransportClient(settingsBuilder()
                .put("cluster.name", "test-cluster-" + NetworkUtils.getLocalAddress().getHostName())
                .put("client.transport.sniff", false).build());
        client.addTransportAddress(server2Address);
        return client;
    }
}
View Full Code Here


    Settings settings = ImmutableSettings.settingsBuilder()
        .put("cluster.name", clusterName).build();

    TransportClient transport = new TransportClient(settings);
    for (InetSocketTransportAddress host : serverAddresses) {
      transport.addTransportAddress(host);
    }
    client = transport;
  }

  private void closeConnection() {
View Full Code Here

                String[] parts = hostname.split(":");
                int port = 9300;
                if (parts.length == 2) {
                    port = Integer.parseInt(parts[1]);
                }
                client.addTransportAddress(new InetSocketTransportAddress(parts[0], port));
            }
        }

        elasticSearchClient.admin().cluster().prepareHealth()
                .setWaitForYellowStatus()
View Full Code Here

        TransportClient transportClient = new TransportClient( settings );
        for ( String node : nodes ) {
            String[] split = node.split( ":" );
            String host = split[0];
            int port = Integer.valueOf( split[1] );
            transportClient.addTransportAddress( new InetSocketTransportAddress( host, port ) );
        }

        client = transportClient;
    }
View Full Code Here

      for (final Entry<String, Integer> address : transportAddresses.entrySet()) {
        if (logger.isInfoEnabled()) {
          logger.info("Adding transport address: " + address.getKey() + " port: "
              + address.getValue());
        }
        client.addTransportAddress(new InetSocketTransportAddress(address.getKey(),
            address.getValue()));
      }
    }

  }
View Full Code Here

    }

    public static Client createClient(String cluster, String url, int port) {
        Settings s = ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
        TransportClient tmp = new TransportClient(s);
        tmp.addTransportAddress(new InetSocketTransportAddress(url, port));
        return tmp;
    }
   
    public abstract String getIndexName();
View Full Code Here

   
    Client client = null;
    TransportClient tmp = null;
    try {
      tmp = new TransportClient(snode);
      client = tmp.addTransportAddress(new InetSocketTransportAddress(sHostname, Integer.parseInt(sPort)));
   
      if (!IndexExistsUtils.exists(client.admin().indices(), indexName)) {
        return false;
      }
      client.admin().cluster().health(new ClusterHealthRequest(indexName).waitForYellowStatus()).actionGet();
View Full Code Here

        sPort = hostPort[1];

        Builder globalSettings = ImmutableSettings.settingsBuilder();
        Settings snode = globalSettings.put("cluster.name", _clusterName).build();
        TransportClient tmp = new TransportClient(snode);
        _elasticClient = new CrossVersionClient(tmp.addTransportAddress(new InetSocketTransportAddress(sHostname, Integer.parseInt(sPort))));
      }
     
    } //TESTED
    else { // Create a "no data" cluster
     
View Full Code Here

        sPort = hostPort[1];
 
        Builder globalSettings = ImmutableSettings.settingsBuilder();
        Settings snode = globalSettings.put("cluster.name", _clusterName).build();
        TransportClient tmp = new TransportClient(snode);
        _elasticClient = new CrossVersionClient(tmp.addTransportAddress(new InetSocketTransportAddress(sHostname, Integer.parseInt(sPort))));
      }
     
    } //TESTED
    else { // Create a "no data" cluster
     
View Full Code Here

    }

    public static Client createClient(String cluster, String url, int port) {
        Settings s = ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
        TransportClient tmp = new TransportClient(s);
        tmp.addTransportAddress(new InetSocketTransportAddress(url, port));
        return tmp;
    }

    public void setTesting(boolean testing) {
        this.testing = testing;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.