Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ public void indexJsonOntoES(String url, String indexJson, Index index) throws Ex
Object response = restTemplate.postForObject(url.toString(), entity, Map.class);
if (url.contains("_bulk")) {
if (JsonPath.read(mapper.writeValueAsString(response), "$.errors").equals(true)) {
log.info("Indexing FAILED!!!!");
log.info("Response from ES: " + response);
log.error("Indexing FAILED!!!! Response from ES: {}", response);
throw new RuntimeException("ES bulk indexing returned errors for URL: " + url + ", response: " + response);
}
}
} catch (final ResourceAccessException e) {
log.error("ES is DOWN, Pausing kafka listener.......");
indexerUtils.orchestrateListenerOnESHealth();
throw new RuntimeException("ES is DOWN, indexing failed for URL: " + url, e);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
log.error("Exception while trying to index to ES. Note: ES is not Down.", e);
throw new RuntimeException("Exception while indexing to ES for URL: " + url, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public String buildJsonForIndex(Index index, String kafkaJson, boolean isBulk, b
result = jsonTobeIndexed.toString();
} catch (Exception e) {
log.error("Error while building jsonstring for indexing", e);
throw new RuntimeException("Failed to build JSON for indexing on index: " + index.getName(), e);
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ public void validateAndIndex(String finalJson, String url, Index index) throws E
else
indexWithESId(index, finalJson);
} else {
log.error("Indexing will not be done, please modify the data and retry.");
log.error("Object: " + finalJson);
log.error("Indexing will not be done, finalJson is empty. Index: {}", index.getName());
throw new IndexerException("Empty JSON produced for index: " + index.getName() + " - please modify the data and retry",
new RuntimeException("Empty/null JSON for index: " + index.getName()));
}
}

Expand Down