Scripted field for Matching Substring

Fixed it myself.

def logger= doc['path.keyword'].value;
if (logger!= null) {
    int lastSlashIndex = logger.lastIndexOf('/');
    int lastUndrIndex = logger.lastIndexOf('_');
    if (lastSlashIndex > 0) {
    return logger.substring(lastSlashIndex+1,lastUndrIndex);
    }
}
return "";