Package org.elasticsearch.client.transport

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


        TransportClient tc = new TransportClient(settings);
        for (String host : hosts) {
            String[] parts = host.split(":");
            String address = parts[0];
            Integer port = Integer.parseInt(parts[1]);
            tc.addTransportAddress(new InetSocketTransportAddress(address, port));
        }
        client = tc;
    }

    public Client getClient() {
View Full Code Here


          throw new RuntimeException("Invalid Host: " + host);
        }
        Logger.info("Transport Client - Host: %s Port: %s", parts[0], parts[1]);
        if (Integer.valueOf(parts[1]) == 9200)
          Logger.info("Note: Port 9200 is usually used by the HTTP Transport. You might want to use 9300 instead.");
        c.addTransportAddress(new InetSocketTransportAddress(parts[0], Integer.valueOf(parts[1])));
        done = true;
      }
      if (done == false) {
        throw new RuntimeException("No Hosts Provided for Elastic Search!");
      }
View Full Code Here

    Settings settings = ImmutableSettings.settingsBuilder()
        .put("cluster.name", clusterName)
        .build();
    TransportClient tclient = new TransportClient(settings);
    for (String node : esNodes) {
      tclient.addTransportAddress(new InetSocketTransportAddress(node, transportPort));
    }
    return tclient;
  }

  protected String getDocumentId(LocalDocument document) {
View Full Code Here

    // Add specified TransportAddresses
    for (String host : hosts.split(",")) {
      String[] params = host.split(":");
      String hostname = params[0];
      int port = (params.length == 2) ? Integer.valueOf(params[1]) : 9300;
      transportClient.addTransportAddress(new InetSocketTransportAddress(hostname, port));
    }
    return transportClient;
  }

  protected void checkConnection(Client client) {
View Full Code Here

                    .build();

            TransportClient transportClient = new TransportClient(settings);
            for (String esHostName : hostNames) {
                LOG.info("Adding TransportClient: {}", esHostName);
                transportClient = transportClient.addTransportAddress(new InetSocketTransportAddress(esHostName,
                        DEFAULT_ELASTICSEARCH_PORT));
            }
            client = transportClient;
        }
View Full Code Here

                String[] hostparts = host.split(":");
                String hostname = hostparts[0];
                int hostport = HOST_PORT_DEFAULT;
                if (hostparts.length == 2) hostport = Integer.parseInt(hostparts[1]);
                log.info("Configured remote host: {} : {}", hostname, hostport);
                tc.addTransportAddress(new InetSocketTransportAddress(hostname, hostport));
            }
            client = tc;
            node = null;
        }
View Full Code Here

        }

    TransportClient client = new TransportClient(builder.build());

    for (int i = 0; i < esNodes.length; i++) {
      client.addTransportAddress(toAddress(esNodes[i]));
    }

    return client;
  }
 
View Full Code Here

        CompositeTestCluster compositeTestCluster = backwardsCluster();
        TransportAddress transportAddress = compositeTestCluster.externalTransportAddress();

        try(TransportClient client = new TransportClient(settings)) {
            client.addTransportAddress(transportAddress);

            assertAcked(client.admin().indices().prepareCreate("test"));
            ensureYellow("test");

            int numDocs = iterations(10, 100);
View Full Code Here

                String[] parts = host.split(":");
                if (parts.length != 2) {
                    throw new Exception("Invalid Host: " + host);
                }
                Logger.info("ElasticSearch : Client - Host: " + parts[0] + " Port: " + parts[1]);
                c.addTransportAddress(new InetSocketTransportAddress(parts[0], Integer.valueOf(parts[1])));
                done = true;
            }
            if (!done) {
                throw new Exception("No Hosts Provided for ElasticSearch!");
            }
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.