How to move elasticsearch text to next line


I have a field in elasticsearch that is very lengthy. So while visualizing that field I am getting the whole value in a straight line which is looking awkward. So I want to split that line into two lines(i.e; separated by \n in the middle).
So how would I achieve that using elasticsearch to be able to visualize it better in Kibana.

If you are on Kibana 5.0, you could look into 'Scripted Fields` (

You can write a formatter function that truncated the line or splits it with a line-break (using HTML <br/> tag).

Hi Thomas,

Thanks for the reply :slight_smile:

In the scripted fields I can see that it works only for numeric values, but I have a String field. If so we can do that, will you be kind in helping me how to do that?


What version of Kibana are you on?

Before 4.0, you can only use scripts for numerical values indeed. But from 5.0 on, you can write scripts for Strings. You would select 'Painless' as your language. And then it would look something like:

I'm on kibana 4.5.4.
I think I should upgrade in order to use that feature. Thanks Thomas.

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