Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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

def test = doc['log_data_numerical'];
return 2;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading