In financial services space, we almost never use float/double in our domain 
- we always use BigDecimal.

In elastic, I would like to be able to index/store BigDecimal in a lossless 
manner (ie what I get back from _source has the same precision, etc as what 
I put in).

When I have had to preserve the json serialisation of BigDecimal, I have 
usually had custom serialiser/deserialisers that printed it out as a json 
number - but whose textual value was toPlainString(). When deserialising, 
creating the BigDecimal with the string value (e.g. '42.5400') maintained 
the precision that was originally serialised
e.g.

{
  verySmallNumber : 0.00000000012000,
  otherNumber : 42.5400
}

Perhaps elastic could index bigdecimal as a double - but store it in the 
source in a lossless fashion.
It would require a user setting, I guess, to treat all floating point 
numbers as BigDecimal.

Thoughts?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/b54dfd5a-3a0e-4946-aa5f-28b3794a92ac%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to