How to move elasticsearch text to next line


(sudarshan reddy) #1

Hello,

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.


(Thomas Neirynck) #2

If you are on Kibana 5.0, you could look into 'Scripted Fields` (https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)

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


(sudarshan reddy) #3

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?

Thanks,
Sudarshan.


(Thomas Neirynck) #4

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:


(sudarshan reddy) #5

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


(system) #6

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