Re: Script - how to round up Float to 2 decimal point?

2015-02-13 Thread Lee Chuen Ooi
Hi David, Yeah, it works. Thanks. On Monday, February 2, 2015 at 2:14:24 PM UTC+8, David Pilato wrote: > > I guess something like this: > > Math.round(7.8151*1000)/1000.0 > > -- > David ;-) > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs > > Le 2 févr. 2015 à 04:03, Lee Chuen Ooi > > a

Re: Script - how to round up Float to 2 decimal point?

2015-02-01 Thread David Pilato
I guess something like this: Math.round(7.8151*1000)/1000.0 -- David ;-) Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs > Le 2 févr. 2015 à 04:03, Lee Chuen Ooi a écrit : > > Hi David, > It works with 100.0. It rounds up to 2 decimal points. > > But, what if we need to round it up to

Re: Script - how to round up Float to 2 decimal point?

2015-02-01 Thread Lee Chuen Ooi
Hi David, It works with 100.0. It rounds up to 2 decimal points. But, what if we need to round it up to 3 or x decimal points? Rounding up a FLOAT, DOUBLE datatype to x decimal points is a common business requirement. I wonder why there isn't any build-in function in ElasticSearh to round up t

Re: Script - how to round up Float to 2 decimal point?

2015-01-31 Thread David Pilato
And this? Math.round(doc['totals.tax'].value * 100.0)/100.0 David > Le 31 janv. 2015 à 09:19, Lee Chuen Ooi a écrit : > > Hi, > It doesn't work. I tried before posting this thread. :-( > > Here is what I use: > > "script" : "Math.round(doc['totals.tax'].value * 100)/100" > > The result is

Re: Script - how to round up Float to 2 decimal point?

2015-01-31 Thread Lee Chuen Ooi
Hi, It doesn't work. I tried before posting this thread. :-( Here is what I use: "script" : "Math.round(doc['totals.tax'].value * 100)/100" The result is an integer. On Saturday, January 31, 2015 at 3:00:19 PM UTC+8, David Pilato wrote: > > Is this not working? Found it on stack over flow.

Re: Script - how to round up Float to 2 decimal point?

2015-01-30 Thread David Pilato
Is this not working? Found it on stack over flow. Math.round(x * 100) / 100 David > Le 31 janv. 2015 à 04:06, Lee Chuen Ooi a écrit : > > Hi, > > Each doc has : > field1 float datatype. For e.g., 99. > field2 float datatype. For e.g., 7.991 > field3 float datatype. For eg., 7.5007500

Script - how to round up Float to 2 decimal point?

2015-01-30 Thread Lee Chuen Ooi
Hi, Each doc has : - field1 float datatype. For e.g., 99. - field2 float datatype. For e.g., 7.991 - field3 float datatype. For eg., 7.5007500800 - field4 float with 2 decimal points. For e.g. 8.10 I need to search doc by filtering out the result of the steps below: 1.