if (params['_source'] != null && params['_source'].containsKey("message") && params['_source']["message"] != null) { String msg = params['_source']["message"]; int pos = msg.indexOf("created"); if (pos >= 0) { // Get everything after the word "created" and trim any extra whitespace String output = msg.substring(pos + "created".length()).trim(); emit(output); } else { emit(null); } } else { emit(null); }