Package org.elasticsearch.client.transport

Examples of org.elasticsearch.client.transport.TransportClient


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

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


    }

    protected ShellNativeClient newTransportClient(TransportAddress... addresses) {

        Settings settings = ImmutableSettings.settingsBuilder().put("client.transport.ignore_cluster_name", true).build();
        org.elasticsearch.client.transport.TransportClient client = new TransportClient(settings).addTransportAddresses(addresses);

        //if no connected node we can already close the (useless) client
        if (client.connectedNodes().size() == 0) {
            client.close();
            return null;
View Full Code Here

                    .local(true)
                    .node();

            elasticSearchClient = elasticSearchNode.client();
        } else {
            TransportClient client = new TransportClient(settings);
            elasticSearchClient = client;

            for (String hostname: properties.getProperty("storage.index.search.hostname", "localhost").split(",")) {
                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

                    .put("cluster.name", configuration.getClusterName())
                    .put("client.transport.ignore_cluster_name", false)
                    .put("node.client", true)
                    .put("client.transport.sniff", true)
                    .build();
            Client client = new TransportClient(settings)
                    .addTransportAddress(new InetSocketTransportAddress(configuration.getIp(), configuration.getPort()));
            this.client = client;
        } else {
            node = configuration.buildNode();
            client = node.client();
View Full Code Here

    public static void main(String[] args) throws Exception {
        new LogfileStreamer().run();
    }

    public LogfileStreamer() {
        client = new TransportClient(ImmutableSettings.settingsBuilder().put("cluster.name", clusterName).build()).addTransportAddress(new
                InetSocketTransportAddress("localhost", 9300));
        reset();
    }
View Full Code Here

                                configuration.ELASTICSEARCH_NODE_SAMPLER_INTERVAL)
                        .build();
        elasticsearchEndpoint = configuration.ELASTICSEARCH_ENDPOINT;
        elasticsearchPort = configuration.ELASTICSEARCH_PORT;
        LOG.info("ElasticsearchEmitter using elasticsearch endpoint " + elasticsearchEndpoint + ":" + elasticsearchPort);
        elasticsearchClient = new TransportClient(settings);
        elasticsearchClient.addTransportAddress(new InetSocketTransportAddress(elasticsearchEndpoint, elasticsearchPort));
    }
View Full Code Here

                put( "client.transport.sniff", clusterSniff ).
                put( "client.transport.ignore_cluster_name", ignoreClusterName ).
                put( "client.transport.ping_timeout", pingTimeout ).
                put( "client.transport.nodes_sampler_interval", samplerInterval ).
                build();
        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

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

    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

        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

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.