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"""
}
}