Just dipping my toes into painless, only it isn't simple painless
I'm trying to conditionally set a field to either one or another field depending on the existence of one field like this:
{
"script": {
"lang": "painless",
"source": "if (ctx.containsKey('epj.user_login')) {\r\n ctx.epj.user = ctx.epj.user_login;\r\n} else {\r\n ctx.epj.user = ctx.log.file.userdir;\r\n}"
}
}
]
but seems to always execute the 'else' part, even when documents actually contains an epj.user_login field, wondering why, any hints appreciated, TIA!