Hi. I have a following string field
string_value.keyword
The following code gives the last part that comes after /
(slash).
How can I get only the first part that comes before /
?
def path = doc['string_value.keyword'].value;
if (path != null) {
int lastSlashIndex = path.lastIndexOf('/');
if (lastSlashIndex > 0) {
return path.substring(lastSlashIndex+1);
}
}
return "";