String comparison in if condition of pipeline doesn't match

I'm trying to create a pipeline in Elasticsearch. I have to make a check before to know what pipeline to use, so I've made a pipeline that do the routing, like this :

{
  "description": "A pipeline of pipelines for log files",
  "version": 1,
  "processors": [
    {
      "pipeline": {
        "if": """ctx.applicative_code =~ /AFA[@]959[@]333-SERVICE[@]1.0.0.SIG/ """,
        "name": "ged_pipeline"
      }
    },
    {
      "fail": {
        "message": "This pipeline requires applicative_code to be one of: 'AFA@959@333-SERVICE@1.0.0.SIG'"
      }
    }
  ]
}

To test it, I use the _simulate API :

POST _ingest/pipeline/logs_pipeline/_simulate
{
  "docs": [
    {
      "_source": {
        "message_log": "127.0.0.1:50613||Download||agent||S0000||PM000||Q||{5C7A4600-C422-4D81-BD02-39072E06F646}",
        "applicative_code": "AFA@959@333-SERVICE@1.0.0.SIG"
      }
    }
  ]
}

And the response is this :

 "error" : {
        "root_cause" : [
          {
            "type" : "exception",
            "reason" : "java.lang.IllegalArgumentException: org.elasticsearch.ingest.common.FailProcessorException: This pipeline requires applicative_code to be one of: 'AFA@959@333-SERVICE@1.0.0.SIG'",
            "header" : {
              "processor_type" : "fail"
            }
          }
        ],
        "type" : "exception",
        "reason" : "java.lang.IllegalArgumentException: org.elasticsearch.ingest.common.FailProcessorException: This pipeline requires applicative_code to be one of: 'AFA@959@333-SERVICE@1.0.0.SIG'",
        "caused_by" : {
          "type" : "illegal_argument_exception",
          "reason" : "org.elasticsearch.ingest.common.FailProcessorException: This pipeline requires applicative_code to be one of: 'AFA@959@333-SERVICE@1.0.0.SIG'",
          "caused_by" : {
            "type" : "fail_processor_exception",
            "reason" : "This pipeline requires applicative_code to be one of: 'AFA@959@333-SERVICE@1.0.0.SIG'"
          }

So, it seems that my condition doesn't match. The reason why i'm using a regex here is that the special character "@" mess up the string comparison. What i've tried so far, in the if condition of the pipeline :

"if": """ctx.applicative_code == "AFA@959@333-SERVICE@1.0.0.SIG" """

Result : doesn't work, the @ is interpreted and I can't escape it using \

"if": """ctx.applicative_code.compareTo("AFA@959@333-SERVICE@1.0.0.SIG") """

Result : Same thing, the @ is interpreted

Any idea ?

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