Floating point precision in response

Hi,

I have a quick question with regards the response of numeric values. I
perform an aggregation with the sum aggregation and when I get back the
response in a curl request the number is shown as follows:

"aggs":{

"day_clicks":{
"sum": {
"field" : "clicks"
}
}
}

response

...

"doc_count": 384,
"day_clicks": {
"value":
2.7372883E7},
....

If you noticed the E7 which is the floating point instead of just
printing the actual number:

...

"value":
27372883*...*

Has anyone faced a similar case? At what level is this happening? in
elastiscearch's response or later. I have noticed in marvel/sense that the
response is coming in this way and the transformation is happening client
side. Is there a way to change that in the response of ES?

Thank you very much

Thomas

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e99a0e58-ea22-49a4-974e-8796c7941c74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Thomas,

This is an annoying property of how JavaScript handles numerics. It makes
no distinction between integer and floating point numbers and has some
heuristics when to display numbers as one or the other. Sadly this one fell
on the wrong side of what you'd expect.

This is only happening in the browsers. Elasticsearch's responses are
formatted as you'd expect. You can validate by copying the request as curl
(under the per request menu in Sense) and running it from a terminal.

Still working on a way to elegantly work around this one.

Cheers,
Boaz

On Wednesday, September 17, 2014 1:14:33 PM UTC+2, Thomas wrote:

Hi,

I have a quick question with regards the response of numeric values. I
perform an aggregation with the sum aggregation and when I get back the
response in a curl request the number is shown as follows:

"aggs":{

"day_clicks":{
"sum": {
"field" : "clicks"
}
}
}

response

...

"doc_count": 384,
"day_clicks": {
"value":
2.7372883E7},
....

If you noticed the E7 which is the floating point instead of just
printing the actual number:

...

"value":
27372883*...*

Has anyone faced a similar case? At what level is this happening? in
elastiscearch's response or later. I have noticed in marvel/sense that the
response is coming in this way and the transformation is happening client
side. Is there a way to change that in the response of ES?

Thank you very much

Thomas

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/eb07d8c3-f66e-454d-b33f-6a213fee56cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.