Elasticsearch painless get string field (which contains XML) into a variable Elasticsearch painless get string field (which contains XML) into a variable elasticsearch elasticsearch

Elasticsearch painless get string field (which contains XML) into a variable


It's an old topic, but just run into the same problem. I was able to solve it using the field definition this way:

def field = params._source.Request.Body;

This code can extract the relevant information from a sting field:

def field = params._source.message;if (field != null) {def matcher = /<decisionText>(.*)<\/decisionText>/.matcher(field);if (matcher.find()) {return matcher.group(1);}return "No match";}return "No field";

In my case the data is in the "message" field