简体   繁体   中英

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

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM