Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhuliquan/scaled_float
Scaled float field type in ElasticSearch, a floating point number that is backed by a long, scaled by a fixed double scaling factor.
https://github.com/zhuliquan/scaled_float
elasticsearch es golang scaledfloat
Last synced: about 2 months ago
JSON representation
Scaled float field type in ElasticSearch, a floating point number that is backed by a long, scaled by a fixed double scaling factor.
- Host: GitHub
- URL: https://github.com/zhuliquan/scaled_float
- Owner: zhuliquan
- License: mit
- Created: 2022-09-18T14:48:19.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-18T15:16:33.000Z (over 2 years ago)
- Last Synced: 2024-11-16T20:37:21.883Z (about 2 months ago)
- Topics: elasticsearch, es, golang, scaledfloat
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Description
Scaled float field type in ElasticSearch, a floating point number that is backed by a long, scaled by a fixed double scaling factor.# Detail
For floating-point types, it is often more efficient to store floating-point data into an integer using a scaling factor, which is what the scaled_float type does under the hood. For instance, a price field could be stored in a scaled_float with a scaling_factor of 100. All APIs would work as if the field was stored as a double, but under the hood Elasticsearch would be working with the number of cents, price*100, which is an integer. This is mostly helpful to save disk space since integers are way easier to compress than floating points. scaled_float is also fine to use in order to trade accuracy for disk space. For instance imagine that you are tracking cpu utilization as a number between 0 and 1. It usually does not matter much whether cpu utilization is 12.7% or 13%, so you could use a scaled_float with a scaling_factor of 100 in order to round cpu utilization to the closest percent in order to save space.