src/main/java/org/novus/es/client/ESClient.java
/**
   * 
   * This api will create transport client based on user cluster information
   * 
   * @param clusterName
   * @param host
   * @param index
   * @param mapping
   * @param restTemplate
   * @return
   * @throws IOException
   */
This api will create transport client based on user cluster information


This api will create transport client based on user cluster information
public static TransportClient createEsClient(String clusterName, String host, String index, String mapping,
      RestTemplate restTemplate) throws IOException {
    Settings settings = Settings.builder().put("cluster.name", clusterName).build();
    TransportClient client = new PreBuiltTransportClient(settings);
    try {
      TransportAddress address = new TransportAddress(new InetSocketAddress(InetAddress.getByName(host), 9300));
      client.addTransportAddress(address);
    } catch (NumberFormatException e) {
      e.printStackTrace();
    }
    if (!StringUtils.isEmpty(mapping)) {
      loadSchema(index, client, mapping);
    }
    return client;
  }
public static TransportClient createEsClient ( String clusterName , String host , String index , String mapping , RestTemplate restTemplate ) throws IOException { Settings settings = Settings . builder ( ) . put ( "cluster.name" , clusterName ) . build ( ) ; TransportClient client = new PreBuiltTransportClient ( settings ) ; try { TransportAddress address = new TransportAddress ( new InetSocketAddress ( InetAddress . getByName ( host ) , 9300 ) ) ; client . addTransportAddress ( address ) ; } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; } if ( ! StringUtils . isEmpty ( mapping ) ) { loadSchema ( index , client , mapping ) ; } return client ; }
This api will create transport client based on user cluster information
This api will create transport client based on user cluster information