code: @PostConstruct
      public void init() throws Exception {
  
          if (hosts == null) {
              throw new IllegalArgumentException("Hosts property not set ");
          }
  
          determineHostsAsProperty();
  
          /**
           * quick fix for integration tests. if hosts property set to "embedded" then a local node is start.
           * maven dependencies need to be defined correctly for this to work
           */
  
          if (hosts.startsWith("embedded")) {
              synchronized (SYNC) {
                  if (node == null) {
                      node = new ElasticsearchEmbeddedNode();
                  }
              }
              client = node.getClient();
          } else {
              String[] hostsArray = hosts.split(",");
              Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
              client = new TransportClient(settings);
  
              for (String aHostsArray : hostsArray) {
                  String s = aHostsArray.trim();
                  String[] host = s.split(":");
  
                  if (log.isLoggable(Level.FINE)) {
                      log.fine(" Connecting to elasticsearch host. [" + host[0] + ":" + host[1] + "]");
                  }
  
                  client = ((TransportClient)client).addTransportAddress(new InetSocketTransportAddress(host[0],
                          new Integer(host[1])));
              }
          }
      }
docs: Initialize the client.
  
  @throws Exception Failed to initialize the client