Hello,
I'm attempting to create a runtime field that parses values from a field based on a regex. I have a field event_trigger
that contains some various strings. I'm looking to find all values which contain giy2
and store in the field group_a
I'm running into a java class error:
"script_stack" : [
"emit (doc['event_trigger'].valu ...",
" ^---- HERE"
],
"script" : "emit (doc['event_trigger'].value =~ /.*giy2.*/)",
"lang" : "painless",
"position" : {
"offset" : 6,
"start" : 0,
"end" : 31
},
"caused_by" : {
"type" : "class_cast_exception",
"reason" : "class_cast_exception: Cannot cast from [boolean] to [java.lang.String]."
Here is the query that I'm running:
{
"runtime_mappings": {
"group_a": {
"type": "keyword",
"script": {
"source": "emit (doc['event_trigger'].value =~ /.*giy2.*/)"
}
}
},
"fields": [
"group_a"
],
"query": {
"wildcard": {
"group_a": "*"
}
}
}
Any help is appreciated