use of org.elasticsearch.client.IndicesAdminClient in project vertigo by KleeGroup.
the class AbstractESSearchServicesPlugin method logMappings.
private void logMappings(final String myIndexName) {
final IndicesAdminClient indicesAdmin = esClient.admin().indices();
final ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> indexMappings = indicesAdmin.prepareGetMappings(myIndexName).get().getMappings();
for (final ObjectObjectCursor<String, ImmutableOpenMap<String, MappingMetaData>> indexMapping : indexMappings) {
LOGGER.info("Index " + indexMapping.key + " CurrentMapping:");
for (final ObjectObjectCursor<String, MappingMetaData> dtoMapping : indexMapping.value) {
LOGGER.info(dtoMapping.key + " -> " + dtoMapping.value.source());
}
}
}
use of org.elasticsearch.client.IndicesAdminClient in project metasfresh-webui-api by metasfresh.
the class KPIDataLoader method assertESTypesExists.
/**
* Checks if KPI's elasticsearch Index and Type exists
*/
public KPIDataLoader assertESTypesExists() {
final IndicesAdminClient admin = elasticsearchClient.admin().indices();
//
// Check index exists
final String esSearchIndex = kpi.getESSearchIndex();
final GetIndexResponse indexResponse = admin.prepareGetIndex().addIndices(esSearchIndex).get();
final List<String> indexesFound = Arrays.asList(indexResponse.getIndices());
if (!indexesFound.contains(esSearchIndex)) {
throw new AdempiereException("ES index '" + esSearchIndex + "' not found in " + indexesFound);
}
logger.debug("Indexes found: {}", indexesFound);
//
// Check type exists
final String esTypes = kpi.getESSearchTypes();
final boolean esTypesExists = admin.prepareTypesExists(esSearchIndex).setTypes(kpi.getESSearchTypes()).get().isExists();
if (!esTypesExists) {
throw new AdempiereException("Elasticseatch types " + esTypes + " does not exist");
}
// All good
return this;
}
Aggregations