Home > Enterprise >  How i can take the value of a number type on kibana scripted field
How i can take the value of a number type on kibana scripted field

Time:04-01

I want to convert all the values of my Pie, they are in second and i want to convert them in min.

The problem is I can't take the value of my index "log_data_numerical" (it's a number type) but i can take the value of another type example: "log_data_name" (keyword type).

I wrote that:

def test = doc['log_data_name'].value; 
return 2;

and when i try to take numerical like that

def test = doc['log_data_numerical'].value;
return 2;

I got

Script is invalid. View script preview for details

so please if someone has an idea it will help me a lot!

Here is some pictures:

  • My Pie 1
  • Two indexes with their values 2
  • The scripted field with the error 3

CodePudding user response:

You need to remove .value for numerical field as shown below.

def test = doc['log_data_numerical'];
return 2;
  • Related