Access field name with blanks via painless

Hi there,

how do I access a field name that includes blanks (e.g. "Event ID" : 23) via script?

ctx.Event\ ID = 42 doesn't work ("Error parsing ingest pipeline: JSON Parse error: Invalid escape character")
neither does ctx.'System Name'.

Any idea?

Thanks and cheers,
Markus

ctx is a Map. The fact it works with bare keys as if they were members of an object is the result of easing migration from groovy scripts when painless was first added.

You can access any key within a Map, regardless of spaces or special characters, using bracket syntax:

ctx['Event ID'] = 42;