Field change value

I want to change the value of the field , so that it only shows the username. In this example, I want to remove the "slu" so that the value only shows "AlbissR" and not "slu\AlbissR"


You can do a scripted field. Something like the below. Just need to replace with your field doc['some_field'].value in both places. (I did my testing in Painless Lab).

This will split the string if it contains an \ and then returns everything after an \. If it doesn't contain an \ then it returns original value.

String[] parts = /\\/.split(;

if(parts.length > 1)
    return parts[1];
} else {

** I would recommend doing this on ingest with an ingest processor if you are able to.

I tried that and I got following error:

[script] Too many dynamic script compilations within, max: [75/5m]; please use indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_rate] setting

I've never hit that error before or really understand the reason. But here is a blog post to work through that error.

If you can't work through that I'd open a new thread for that specific error and someone who has seen those can help.