class ElasticSearchClientFactory {

  public ElasticSearchClient getClient(String clientType, String[] hostNames,
      String clusterName, ElasticSearchEventSerializer serializer,
      ElasticSearchIndexRequestBuilderFactory indexBuilder) throws NoSuchClientTypeException {
    if (clientType.equalsIgnoreCase(TransportClient) && serializer != null) {
      return new ElasticSearchTransportClient(hostNames, clusterName, serializer);
    } else if (clientType.equalsIgnoreCase(TransportClient) && indexBuilder != null) { 
      return new ElasticSearchTransportClient(hostNames, clusterName, indexBuilder);
    } else if (clientType.equalsIgnoreCase(RestClient) && serializer != null) {
      return new ElasticSearchRestClient(hostNames, serializer);
    }
    throw new NoSuchClientTypeException();
  }

}