Examples of TransportClient


Examples of org.elasticsearch.client.transport.TransportClient

      throw new NullPointerException("transportClientSettings");
    }
    if (index == null) {
      throw new NullPointerException("index");
    }
    _client = new TransportClient(transportClientSettings);
    _index = index;
  }
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient

    port = job.getInt(ElasticConstants.PORT, -1);
   
    // Prefer TransportClient
    if (host != null && port > 1) {
      Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", clusterName).build();
      client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(host, port));
    } else if (clusterName != null) {
      node = nodeBuilder().clusterName(clusterName).client(true).node();
      client = node.client();
    }
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient

        Logger.getLogger("test").info("querying " + searchHost + ":" + searchPort
                + " at " + searchIndexName + " with " + basicAuthCredentials);

        Settings settings = ImmutableSettings.settingsBuilder()
                .put("cluster.name", cluster).build();
        Client client = new TransportClient(settings).
                addTransportAddress(new InetSocketTransportAddress(searchHost, searchPort));

        Settings emptySettings = ImmutableSettings.settingsBuilder().build();
        RestController contrl = new RestController(emptySettings);
        ReIndexAction action = new ReIndexAction(emptySettings, client, contrl) {
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient

  public void afterPropertiesSet() throws Exception {
    internalCreateTransportClient();
  }

  private void internalCreateTransportClient() {
    final TransportClient client = new TransportClient();

    if (null != transportAddresses) {
      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

Examples of org.elasticsearch.client.transport.TransportClient

        client = createClient(ElasticNode.CLUSTER, url, port);
    }

    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;
    }
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient

    Builder globalSettings = ImmutableSettings.settingsBuilder();
    Settings snode = globalSettings.put("cluster.name", _clusterName).build();
   
    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();
    }
    catch (Exception e) { // Index not alive...
      return false;
    }
    finally {
      if (null != client) {
        client.close(); // (will also close tmp)
      }
      else if (null != tmp) {
        tmp.close();
      }
    }
    return true;
  }
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient

        sHostname = hostPort[0];
        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

Examples of org.elasticsearch.client.transport.TransportClient

        sHostname = hostPort[0];
        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

Examples of org.elasticsearch.client.transport.TransportClient

        client = createClient(ElasticNode.CLUSTER, url, ElasticNode.PORT);
    }

    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;
    }
View Full Code Here

Examples of org.elasticsearch.client.transport.TransportClient

        List<String> hosts = config.getListProperty(ElasticIOConfig.ELASTICSEARCH_HOSTS);
        String clusterName = config.getStringProperty(ElasticIOConfig.ELASTICSEARCH_CLUSTERNAME);
        Settings settings = ImmutableSettings.settingsBuilder()
                .put("cluster.name", clusterName)
                .build();
        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;
    }
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.