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
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
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
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
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.
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
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.