Elastic pipeline compare two fields condition

Im trying to create a set condition if two fields are the same, ive not been able to find how to do this with the elastic pipeline

ctx.dns.question.name =='{{{ctx.host.hostname}}}'

Try this

POST _ingest/pipeline/_simulate
{
  "docs": [
    {
      "_source": {
        "a": "c",
        "b": "c"
      }
    },
    {
      "_source": {
        "a": "c",
        "b": "d"
      }
    }
  ],
  "pipeline": {
    "processors": [
      {
        "script": {
          "source": "if (ctx.a == ctx.b) { ctx.c = 'SAME'}"
        }
      }
    ]
  }
}

Thats perfect thank you, i dont know why i felt as though it should be different to fieldA == fieldB

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