Package org.elasticsearch.client.transport

Examples of org.elasticsearch.client.transport.TransportClient


      searchClient = searchNode.client();
      if (!existsIndex(Config.APP_NAME_NS)) {
        createIndex(Config.APP_NAME_NS);
      }
    } else {
      searchClient = new TransportClient();
        ((TransportClient) searchClient).addTransportAddress(
            new InetSocketTransportAddress("localhost", 9300));
    }

    Para.addDestroyListener(new Para.DestroyListener() {
View Full Code Here


            node = nb.node();
            client = node.client();
            Logger.info("ElasticSearch : Started in Local Mode");
        } else {
            Logger.info("ElasticSearch : Starting in Client Mode");
            TransportClient c = new TransportClient(settings);
            if (config.client == null) {
                throw new Exception("Configuration required - elasticsearch.client when local model is disabled!");
            }

            String[] hosts = config.client.trim().split(",");
            boolean done = false;
            for (String host : hosts) {
                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

        transportAddr = ((InternalNode) node).injector()
                .getInstance(TransportService.class)
                .boundAddress()
                .publishAddress();

        transportClient = new TransportClient(ImmutableSettings.builder()
                    .put("cluster.name", node.settings().get("cluster.name"))
                    .put("client.transport.sniff", true))
                .addTransportAddress(transportAddr);

        restAddr = ((InternalNode) node).injector()
View Full Code Here

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

    protected void buildClient() throws Exception {
        client =  new TransportClient(settings());
        Assert.notEmpty(clusterNodes,"[Assertion failed] clusterNodes settings missing.");
        for (String clusterNode : clusterNodes) {
            String hostName = substringBefore(clusterNode, COLON);
            String port = substringAfter(clusterNode, COLON);
            Assert.hasText(hostName,"[Assertion failed] missing host name in 'clusterNodes'");
View Full Code Here

TOP

Related Classes of org.elasticsearch.client.transport.TransportClient

Copyright © 2018 www.massapicom. 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.