As painless does not support
\n, as per https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-literals.html
you have to get ASCII newline
0x0a, cast to char and then cast to string https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-casting.html#character-string-casting
So to split your string in Painless on newline you have to
And yes that sounds retarted.