Hi, my doc looks like this and I need to access log.level which is a nested field. can someone help me as I need a condition to set a new field called statuscode if log.level=error.

tried ctx.messageinfo.log.level=="error" and ctx?.messageinfo?.log.level=="error"
both did not work
Think you are looking for this.
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"set": {
"field": "field-name",
"value": "value",
"if": "ctx.messageinfo['log.level'] == 'error'"
}
}
]
},
"docs": [
{
"_source": {
"messageinfo": {
"log.level": "error"
}
}
}
]
}
Thanks a ton Aaron . This works as expected. Much appreciated!