Access _ingest using Painless script

I'm trying to populate an array during ingestion within a sub-pipeline.
To do so, I'm using a painless script like the following that gives this error.
What am I doing wrong?

Script:

{
  "script":{
    "source":"ctx.MyArray.Add(ctx._ingest._value)"
  }
}

But I always get a null ref on _ingest

"error" : {
  "root_cause" : [
    {
      "type" : "script_exception",
      "reason" : "runtime error",
      "script_stack" : [
        "ctx.MyArray.Add(ctx._ingest._value)",
        "                           ^---- HERE"
      ],
      "script" : "ctx.MyArray.Add(ctx._ingest._value)",
      "lang" : "painless",
      "position" : {
        "offset" : 27,
        "start" : 0,
        "end" : 35
      }
    }
  ],
  "type" : "script_exception",
  "reason" : "runtime error",
  "script_stack" : [
    "ctx.MyArray.Add(ctx._ingest._value)",
    "                           ^---- HERE"
  ],
  "script" : "ctx.MyArray.Add(ctx._ingest._value)",
  "lang" : "painless",
  "position" : {
    "offset" : 27,
    "start" : 0,
    "end" : 35
  },
  "caused_by" : {
    "type" : "null_pointer_exception",
    "reason" : """Cannot invoke "Object.getClass()" because "callArgs[0]" is null"""
  }
}

If no one is replying, does it mean it is impossible to access _ingest in Painless script?

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