How to filter the document contain some tags?

My document may contain a tag msg_type

"_source": {
    "@timestamp": "2022-04-11T08:06:38.519Z",
    "message": "xxxx",
    "msg_type": [
      "risk_info"
    ]
  }

I wanna use Pipeline Processor to execute another pipeline when risk_info tag exists, but got (from kibana)

pipeline processor: compile error

PUT _ingest/pipeline/risk_info_filter
{
  "description": "filter of risk info if message contains risk_info tag",
  "processors": [
    {
      "pipeline": {
        "name": "risk_info",
        "if": "ctx.msg_type?[0] == 'risk_info'"
      }
    }
  ]
}

Even copy of the code document is wrong. Is there any way I can get the details of the error message?

try this:

    {
      "pipeline": {
          "if": """
            Collection types = ctx.msg_type;
            if(types != null){
              for (String type : types) {
                if (type.toLowerCase().contains('risk_info')) {
                  return true;
                }
              }
            }
            return false;
        """,
        "name": "risk_info"
      }
    }

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