use of org.n52.iceland.statistics.api.utils.dto.KibanaConfigEntryDto in project arctic-sea by 52North.
the class KibanaImporter method importJson.
public void importJson(String jsonString) throws JsonParseException, JsonMappingException, IOException {
Objects.requireNonNull(jsonString);
// delete .kibana index
try {
client.admin().indices().prepareDelete(kibanaIndexName).get();
} catch (ElasticsearchException ex) {
LOG.debug("Tried to delete kibana index " + kibanaIndexName + " but it is not exists", ex);
}
ObjectMapper mapper = new ObjectMapper();
KibanaConfigHolderDto holder = mapper.readValue(jsonString, KibanaConfigHolderDto.class);
for (KibanaConfigEntryDto dto : holder.getEntries()) {
processDto(dto);
LOG.debug("Importing {}", dto);
client.prepareIndex(kibanaIndexName, dto.getType(), dto.getId()).setSource(dto.getSource()).get();
}
}
Aggregations