Put names to the values of a field

Hi.

I did a pie chart with a field that have a numeric value that represent the code of a operation.

This field is called oper. So in this field I can count how many kinds of operations occurs in 1 day. So in the pie chart I can see, for example, that there was 5 operations with the code 2 and 10 operations with the code 7, etc.

So, until this point everything is fine.

But I need to put the name of the code operation in the legend of the chart. I mean the code 2 operations are yellow operations, and the code 7 are de blue operations. So in the legend of the pie chart I need to display this yellow instead of 2 and blue instead fo 7 and so on for all de codes operations.

Something like tihs.

                                                                                   "legend"
                                                                                   2  - yellow

this is 5 - red
my 4 - black
pie chart 7 - blue

I have the list of the codes in a Excel file. The names doesn't come in the info that are being inserted on Elasticsearch.

I would use a scripted field for that.

To get started, see

Write a script that maps each code to a readable name (2->yellow, 7->blue, ...)

Then, make your pie-chart using the scripted field instead.

1 Like

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