Hello! I am trying to create a new variable on a Data View using this painless script, but when trying to save, I am getting the generic error "Invalid Painless Script". The error also tells be to fix the highlighted errors, but there are no highlighted errors. Here is the script in question
if (doc.containsKey("ProcessCrash_split")){
def processCrash = doc["ProcessCrash_split"].value;
int commaIndex = processCrash.lastIndexOf(",");
if (commaIndex > 0){
emit(processCrash.substring(commaIndex+1));
return;
}
emit(processCrash);
return;
}
emit("noCrash");
return;
Note: * this script works on the dev tools query editor, replacing "emit(***)" with "return ***"