Label value formatter inside a Visual to show unescaped text

(Jeremy Colton) #1

My Elastic Search index has a String field "event" which has many escaped values Eg

When I build visuals (line graphs, pie charts etc.) using this field, the values shown are also escaped (Eg "App%20Loaded"). The end-user is not technical and doesn't understand what this is. How can I get Kibana to display the unescaped text eg "App Loaded"?

I read about field formatters but I think this is ONLY for displaying fields in the Discovery tab of Kibana, not inside visuals.

Many thanks.

(Joe Fleming) #2

Field formatters are definitely the way to solve this, and adding one would in fact affect the labels on visualizations.

Unfortunately, there's not a string replacement or url encode/decode formatter at the moment. If you're a developer, you could write your own, and even install it as a plugin though, it's pretty easy to figure out how by looking at the existing filters.

The other alternative is to use the custom label functionality introduced recently, assuming you're Kibana version is up to date.

(Jeremy Colton) #3

Hi Joe,

The values of each label are dynamic. So I can't use the 'custom label functonality' unless it allows dynamic values and also has a string decoder. Does it?

(Joe Fleming) #4

It does not, custom labels are simple static values you'd like to display instead of the field name.

Writing a custom field formatter sounds like your best bet. There's also a related regex filter request on our repo, feel free to drop a comment or +1 over there as well. If you end up writing something, we'd love to hear about it, or even better, work with you to get it into Kibana.

(Jeremy Colton) #5

Hi, I'm gonna look at writing a custom filter for this. Please can you provide a link to an existing filter and how it's integrated? If I get it working, I'll let you know so it can perhaps be integrated.

(Joe Fleming) #6

Kibana is actually written in large part as a collection of different plugins, and you can see a bunch of examples by looking at the source. It uses various registers as a way to extend components. You can see this in the way that we provide the default field formatters by looking at this registry file.

So basically, in your plugin, you import fieldFormats from 'ui/registry/field_formats'; and then fieldFormats.register your custom formatter.

As for writing your plugin as an actual plugin, we have a yeoman generator to help you get started. Unfortunately we don't yet have concrete documentation around building a plugin, but if the source isn't good enough, this user wrote up an excellent blog post for creating a custom field formatter, as well as many other types of Kibana plugins. There's also this video from Elasticon '16 that you might find helpful.

And of course, if you have questions along the way, feel free to post here, or if you need faster answers, come bug us in IRC; we're in #kibana on freenode.

(system) #7