Using Template Snippet with Pipeline Processor

Hey there !
I have a question about the pipeline processor.
Does the processor provides the functionality of templating?
I want to use different pipelines based on a field name.
i tried using the following pipeline, but unfortunately it doesn't work.
elasticsearch is looking for a pipeline called "netzwerk_{{myfield}}_pipeline" and not
for the actual pipeline

{
  "description" : "outer network pipeline",
  "processors" : [
    {
      "pipeline" : {
        "name": "netzwerk_{{myfield}}_pipeline"
      }
    },
    {
        "script" : {
          "lang" : "painless",
          "source" : """
			    if (ctx.monitor.status == "up"){
              ctx.rtt.ms = ctx.rtt.us * params.divisor;
              }
            """,
            "params": {
              "divisor" : 0.001
            }
          }
    },
    {
      "set" : {
        "field" : "testfield",
        "value" : "testvalue"
      }
    }
  ]
}

Is this somehow possible ?

Found a solution for my problem.
You can use conditional within the pipeline processor.

PUT _ingest/pipeline/logs_pipeline
{
  "description": "A pipeline of pipelines for log files",
  "version": 1,
  "processors": [
    {
      "pipeline": {
        "if": "ctx.service?.name == 'apache_httpd'",
        "name": "httpd_pipeline"
      }
    },
    {
      "pipeline": {
        "if": "ctx.service?.name == 'syslog'",
        "name": "syslog_pipeline"
      }
    },
    {
      "fail": {
        "message": "This pipeline requires service.name to be either `syslog` or `apache_httpd`"
      }
    }
  ]
}

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