protected ESClient getESClient() { ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class); return esa.getClient(); }
protected ESClient getClient() { log.info("Activate Elasticsearch backend for Audit"); ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class); ESClient client = esa.getClient(); ensureUIDSequencer(client); return client; }
@Override public void init() { if (esClient != null) { return; } ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class); esClient = esa.getClient(); indexName = esa.getIndexNameForType(ElasticSearchConstants.SEQ_ID_TYPE); try { boolean indexExists = esClient.indexExists(indexName); if (!indexExists) { throw new NuxeoException( String.format("Sequencer %s needs an elasticSearchIndex contribution with type %s", getName(), ElasticSearchConstants.SEQ_ID_TYPE)); } } catch (NoSuchElementException | NuxeoException e) { dispose(); throw e; } }
esa.refreshRepositoryIndex(repo.getRepositoryName()); if (waitForAuditStoredInEs) { esa.getClient().refresh(esa.getIndexNameForType(ElasticSearchConstants.ENTRY_TYPE));
@Override public ProbeStatus run() { String[] indices = getIndexNames(); try { ClusterHealthStatus clusterStatus = Framework.getService(ElasticSearchAdmin.class) .getClient() .getHealthStatus(indices); switch (clusterStatus) { case GREEN: case YELLOW: return ProbeStatus.newSuccess(clusterStatus.toString()); default: return ProbeStatus.newFailure(clusterStatus.toString()); } } catch (NuxeoException e) { return ProbeStatus.newError(e); } }