Custom fieldformat from int to string

Hi there,

I have a bunch of documents with the attribute status, which can be an integer from 0 to 5. I now want in the visualisation instead of the numbers 0 to 5 strings for these, like 0 = New, 1 = edited, etc. I don't really know how I can achieve this. The only way I'm comming up with is to hook up a tiny webserver which does the magic. Any help how I can manage this without a webserver is apprechiated.

You can create a scripted field to do this:

  1. Click Management
  2. Click Index Patterns
  3. Click the desired index pattern
  4. Click Scripted Fields
  5. Click Add Scripted Field
  6. Choose a name for the field, e.g. status_string
  7. Select string as the type
  8. In the script, type something like the following:
def status = doc['status'].value;
if (status == 0) return 'New';
if (status == 1) return 'edited';
// etc.

Save the scripted field, and you should see it everywhere in Kibana!

Thanks, that works just fine.