I want to create new script field in Kibana. I want to using regex to cut some text from another field ('message') and fill to new script field. I follow instruction link below:
( Match a string and return that match section in this link)
My code here:
def m = /^.*\.([a-z]+)$/.matcher(doc['message'].value);
if ( m.matches() ) {
return m.group(1)
} else {
return "no match"
}
But it didn't work.
Script is invalid. View script preview for details
and kibana mark 'matcher' as a error (red line under that text).
Can you give me some idea or solution? Thanks.