Package org.elasticsearch.common.transport

Examples of org.elasticsearch.common.transport.InetSocketTransportAddress


      for (int i = 0; i < hostNames.length; i++) {
        String[] hostPort = hostNames[i].split(":");
        String host = hostPort[0];
        int port = hostPort.length == 2 ? Integer.parseInt(hostPort[1])
            : DEFAULT_PORT;
        serverAddresses[i] = new InetSocketTransportAddress(host, port);
      }

      Preconditions.checkState(serverAddresses != null
          && serverAddresses.length > 0, "Missing Param:" + HOSTNAMES);
    }
View Full Code Here


    parameters.put(TTL, "10");

    fixture = new ElasticSearchSink();
    fixture.configure(new Context(parameters));

    InetSocketTransportAddress[] expected = { new InetSocketTransportAddress(
        "10.5.5.27", DEFAULT_PORT) };

    assertEquals("testing-cluster-name", fixture.getClusterName());
    assertEquals(
        "testing-index-name-" + ElasticSearchSink.df.format(new Date()),
View Full Code Here

    parameters.remove(CLUSTER_NAME);

    fixture = new ElasticSearchSink();
    fixture.configure(new Context(parameters));

    InetSocketTransportAddress[] expected = { new InetSocketTransportAddress(
        "10.5.5.27", DEFAULT_PORT) };

    assertEquals(
        DEFAULT_INDEX_NAME + "-" + ElasticSearchSink.df.format(new Date()),
        fixture.getIndexName());
View Full Code Here

    fixture = new ElasticSearchSink();
    fixture.configure(new Context(parameters));

    InetSocketTransportAddress[] expected = {
        new InetSocketTransportAddress("10.5.5.27", DEFAULT_PORT),
        new InetSocketTransportAddress("10.5.5.28", DEFAULT_PORT),
        new InetSocketTransportAddress("10.5.5.29", DEFAULT_PORT) };

    assertArrayEquals(expected, fixture.getServerAddresses());
  }
View Full Code Here

    fixture = new ElasticSearchSink();
    fixture.configure(new Context(parameters));

    InetSocketTransportAddress[] expected = {
        new InetSocketTransportAddress("10.5.5.27", 9300),
        new InetSocketTransportAddress("10.5.5.28", 9301),
        new InetSocketTransportAddress("10.5.5.29", 9302) };

    assertArrayEquals(expected, fixture.getServerAddresses());
  }
View Full Code Here

    for (int i = 0; i < hostNames.length; i++) {
      String[] hostPort = hostNames[i].trim().split(":");
      String host = hostPort[0].trim();
      int port = hostPort.length == 2 ? Integer.parseInt(hostPort[1].trim())
              : DEFAULT_PORT;
      serverAddresses[i] = new InetSocketTransportAddress(host, port);
    }
  }
View Full Code Here

        TransportClient client = new TransportClient();
        for (String esLocation : esLocations) {
            String[] locationSocket = esLocation.split(":");
            String host = locationSocket[0];
            String port = locationSocket.length > 1 ? locationSocket[1] : "9300";
            client.addTransportAddress(new InetSocketTransportAddress(host, Integer.parseInt(port)));
        }
        LOGGER.info("index %s exists?", indexName);
        IndicesExistsRequest existsRequest = client.admin().indices().prepareExists(indexName).request();
        if (client.admin().indices().exists(existsRequest).actionGet().isExists()) {
            LOGGER.info("index %s exists... deleting!", indexName);
View Full Code Here

    /* Settings settings = ImmutableSettings.settingsBuilder()
                .put("cluster.name", "myClusterName").build()
                .put("client.transport.sniff", true).build();*/
   
    client = new TransportClient()
        .addTransportAddress(new InetSocketTransportAddress(url, port));
   
    //node = nodeBuilder().client(true).node();
    //client = node.client();
  }
View Full Code Here

        node = config.buildNode();
        if (config.getIp() != null && !config.isLocal()) {
            Settings settings = ImmutableSettings.settingsBuilder()
                    .put("cluster.name", config.getClusterName()).put("node.client", true).build();
            Client client = new TransportClient(settings)
                    .addTransportAddress(new InetSocketTransportAddress(config.getIp(), config.getPort()));
            this.client = client;
        } else {
            client = node.client();
        }
    }
View Full Code Here

    Settings settings = settingsBuilder.build();

    // Prefer TransportClient
    if (host != null && port > 1) {
      client = new TransportClient(settings)
          .addTransportAddress(new InetSocketTransportAddress(host, port));
    } else if (clusterName != null) {
      node = nodeBuilder().settings(settings).client(true).node();
      client = node.client();
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.transport.InetSocketTransportAddress

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.