I am going to transform the @timestamp value of every hit in my watch and write it to another field.
When trying to access the @timestamp value with painless, I am receiving an error:
"type": "general_script_exception", "reason": "failed to compile script [ScriptException[compile error]; nested: IllegalArgumentException[unexpected character [@].]; nested: LexerNoViableAltException;]" }, "status": 500
My transform-part looks as follows:
"transform" : { "script" : "for (int i=0; i<ctx.payload.hits.hits.size(); i++)
{
ctx.payload.hits.hits[i].formatted_timestamp = ctx.payload.hits.hits[i]._source.@timestamp
}
return ctx.payload"
},
Is there any trick to access the @timestamp-field?