@Override public boolean hasIndex(@NotNull ValueTable valueTable) { ClusterStateResponse resp = opalSearchService.getClient().admin().cluster().prepareState().execute().actionGet(); ImmutableOpenMap<String, MappingMetaData> mappings = resp.getState().metaData().index(getName()).mappings(); return mappings.containsKey(getIndex(valueTable).getIndexName()); }
@NotNull protected IndexMetaData createIndex() { IndicesAdminClient idxAdmin = opalSearchService.getClient().admin().indices(); if (!idxAdmin.exists(new IndicesExistsRequest(getName())).actionGet().isExists()) { log.info("Creating index [{}]", getName()); idxAdmin.prepareCreate(getName()).setSettings(getIndexSettings()).execute().actionGet(); } return opalSearchService .getClient() .admin() .cluster() .prepareState() .setIndices(getName()) .execute() .actionGet() .getState() .getMetaData() .index(getName()); }
@Override public boolean isReady() { return opalSearchService.isEnabled() && indexConfig.getConfig().isEnabled(); }