ElasticsearchIndexer implements Indexer { @Override public boolean getHealth() { try { return client.ping(RequestOptions.DEFAULT); } catch (IOException e) { LOGGER.error("Index Health Error : ",e); return false; } } @Inject  ElasticsearchIndexer(final RestHighLevelClient esClient, final PropertiesProvider propertiesProvider); @Override void close(); @Override boolean bulkAdd(final String indexName, Pipeline.Type nerType, List<NamedEntity> namedEntities, Document parent); @Override boolean bulkUpdate(String indexName, List<? extends Entity> entities); @Override void add(final String indexName, T obj); @Override void update(String indexName, T obj); @Override String executeRaw(String method, String url, String rawJson); T get(String indexName, String id); @Override T get(String indexName, String id, String root); @Override boolean tag(Project prj, String documentId, String rootDocument, Tag... tags); @Override boolean untag(Project prj, String documentId, String rootDocument, Tag... tags); @Override boolean tag(Project prj, List<String> documentIds, Tag... tags); @Override boolean untag(Project prj, List<String> documentIds, Tag... tags); @Override Searcher search(final String indexName, Class<? extends Entity> entityClass); @Override boolean createIndex(final String indexName); @Override boolean deleteAll(String indexName); ElasticsearchIndexer withRefresh(WriteRequest.RefreshPolicy refresh); @Override boolean getHealth(); final RestHighLevelClient client; }
@Test public void test_es_index_status() throws IOException { assertThat(indexer.getHealth()).isTrue(); }