Concatenate fields and add newlines


(ben) #1

I want to combine several fields in Kibana's scripted fields editor using painless. I've got the following, but the field displays in Kibana's Discover interface with the literal \n rather than with a new line:

doc['field1'].value + '\\n' + doc['field2'].value

Secondary question: how do I check if doc['somefield'].value has a value before i include it?


(Nathan Reese) #2

You could use the elvis operator to do something only if the value is provided.

I do not think you can display scripted field results with newlines. In kibana, scripted field results are rendered as text strings so newlines or html will just be displayed as raw text without any formatting applied.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.