private static void executeSingleAction(JestClient client, BulkableAction<DocumentResult> action) throws IOException {
DocumentResult result = client.execute(action);
if(result == null || result.getResponseCode() == 404){
if(LOG.isDebugEnabled()) {
if (result == null) {
logEsDebug(action.getRestMethodName(), action.getIndex(), action.getType(), null, -1, null);
} else {
logEsDebug(action.getRestMethodName(), action.getIndex(), action.getType(), result.getJsonString(), result.getResponseCode(), result.getErrorMessage());
}
LOG.debug("index name "+action.getIndex() + " doesn't exist, creating new index");
}
createIndex(client, action.getIndex(), action.getType());
result = client.execute(action);
}
if (result == null) {
logEsError(action.getRestMethodName(), action.getIndex(), action.getType(), null, -1, null);
} else if (!result.isSucceeded()){
logEsError(action.getRestMethodName(), action.getIndex(), action.getType(), result.getJsonString(), result.getResponseCode(), result.getErrorMessage());
} else if(LOG.isDebugEnabled()) {
logEsDebug(action.getRestMethodName(), action.getIndex(), action.getType(), result.getJsonString(), result.getResponseCode(), result.getErrorMessage());
}
}