ElasticSearchClient { protected RestHighLevelClient restClientBuilder(Config elasticSearchConfig) { RestHighLevelClient client = null; try { client = new RestHighLevelClient( RestClient.builder(new HttpHost(elasticSearchConfig.getString(HOST), elasticSearchConfig.getInt(PORT1), elasticSearchConfig.getString(SCHEME)), new HttpHost(elasticSearchConfig.getString(HOST), elasticSearchConfig.getInt(PORT2), elasticSearchConfig.getString(SCHEME)))); } catch (Exception e) { log.error(e.getMessage(),e); } return client; } ElasticSearchClient(); BulkResponse bulk(BulkRequest bulkRequest, RequestOptions requestOptions); BulkByScrollResponse deleteByQuery(DeleteByQueryRequest deleteByQueryRequest, RequestOptions requestOptions); RestHighLevelClient getClient(); boolean close();  }
@Test public void testRestClientBuilder() { Config esConfig = VisualizerUtility.getConfig("elastic-search"); RestHighLevelClient restHighLevelClient = elasticSearchClient.restClientBuilder(esConfig); assertNotNull(restHighLevelClient); }
@Test public void testRestClientBuilderWrongConfig() { Config esConfig = VisualizerUtility.getConfig("metric-consumer"); RestHighLevelClient restHighLevelClient = elasticSearchClient.restClientBuilder(esConfig); assertNull(restHighLevelClient); }