Scripted field return wrong value

I'm trying to verify the CPU usage percentage for a box with topbeat with everything in default, only change I made is instead of output to elasticsearch, the output is logstash.

This is the scripted field:

script: doc['cpu.user_p'].value

and this is the visualization to compare the CPU percentage of 2 field: cpu.user_p and cpu_user_percentage (scripted field)

while cpu.user_p is correct, the scripted field return the wrong value although the format for both field are the same, and the script should give back the native value of cpu.user_p field based on this documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_document_fields

Did I understand the scripted field wrong or it's a bug?

Thank you.

Hey Minh,

Do you have spy panel screenshots, or json for me to look at?

Does it work if you use source.cpu.user_p?

Have you tried it without the formatting as well?