I have two fields (px_last and implied_price) that I am trying to find the percent difference of using a scripted field in painless. I ran into problems trying to calculate it when I saw I was getting results of 200% deviation, which was being caused by the first field being interpreted as 0 whenever the field was between 0 and 1. Even when I try to simply print the value in a dummy scripted field
price it rounds to 0:
I've checked the mappings and ensured both fields were floats, tried multiplying by 100.0 then dividing by 100.0, and explicitly casting the value to a double, but all yield a value of 0. I also changed the format of the scripted field to show 3-5 decimals places. I'm using Kibana 5.6.8 and Elasticsearch 5.6.9.
Here's an example of an affected row:
I've tried searching all related issues on the elastic forum and checked the issues on the github repository and couldn't find anything that helped solve my problem, so any help would be appreciated.