Regex on filtered data on Kibana

Hi, is there any feature that can add regex and show the data on visualization?
Like Name is 123@bc.com. it should show only 123

Hi @Anil_Alapati!

There is an option to create a new data view field, define a custom script for it, set a formatter if necessary and use the field later in visualizations.


Hi,

Thank you. I did that. I can see the truncated string option.

Only problem is I am getting 3 dots extra. Any idea?

Input is 1234567@abcde.com
Output is 1234567...

I would not recommend using "Truncated string" formatter here as it won't work for other values. Defining a custom script to parse and build a displayed value would be more flexible.

Sure. Do you have any sample of custom script?

Hi @Anil_Alapati,

Here is an example how to get only the first part an email (if email field is named as "email", otherwise please adjust):

def email = doc["email"].value;
if (email != null) {
    int index = email.indexOf('@');
    if (index > 0) {
        emit(email.substring(0, index));
        return;
    }
}
emit("");

hi,

can i map the newly created filed to the old field available in the Elasticsearch?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.