Calcul producing a negative result

Hello Everyone.
I'm facing to a negative value while calculting a value from a field.

After creating the index, I add a new field using the path Data Views -> "index_name" in Kibana and set value for this new field like this:

emit(( 100000 * (double) doc['Cell_Out_of_Service_Duration'].value ) / (8302 * 86400 * 5))

For example, when doc['Cell_Out_of_Service_Duration'].value is 900, the result must be 0.025094355 but the result from calculation is -0.127.

Can somebody help why this kind of result.
Thanks in advance

Hello,
I forgot to mention the version:

Elasticsearch : 8.3
Kibana : 8.3
Operating Sys : Red Hat Enterprise Linux 8.5 (Ootpa)

Thanks for your help.

Assuming you are making the field type a double try

Hello @stephenb ,

Yes, the field is construct with double as type. And thanks a lots. It's work perfectly! The logic is really correct. I thought that the conversion will be implicite as I have C++ as background.

Thanks a lots!

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