3

I'm trying to figure out what numbers I can represent using scaled_float.

In the documentation here https://www.elastic.co/guide/en/elasticsearch/reference/master/number.html I first read:

scaled_float

A floating point number that is backed by a long, scaled by a fixed double scaling factor.

So it seems that the size in memory is fixed: a long, that would take 64 bits in memory (the scaling factor being fixed, it's the same for every value and so it doesn't appear in the memory representation of the numbers)

But later on the same page I read, about scaled_float:

High values of scaling_factor improve accuracy but also increase space requirements. This parameter is required.

So it seems, actually the size of a scaled_float is not fixed? Could I represent very, very big numbers and very, very small numbers in the same field if I wanted to? Or are there limits and if so what are those limits?

1 Answer 1

-1

The "real" size(in memory or disk) is not fixed, depends of the value of scaling_factor. scaling_factor its an additional parameter of scaled_float.

scaling_factor .- Values will be multiplied by this factor at index time and rounded to the closest long value. For instance, a scaled_float with a scaling_factor of 10 would internally store 2.34 as 23 and all search-time operations (queries, aggregations, sorting) will behave as if the document had a value of 2.3. High values of scaling_factor improve accuracy but also increase space requirements. This parameter is required.

scaled_float.- A floating point number that is backed by a long, scaled by a fixed double scaling factor

scaling factor its fixed once its defined.

2
  • I've read that part of the doc. Precisely what you quote seems to indicate that the size in memory is fixed. "A floating point number that is backed by a long". How could it be smaller or bigger than 64 bits in memory? Mar 11, 2021 at 19:38
  • scaled_float is fixed, because always is stored as long. scaled_float its stored as long, represented as float at search time. I meant the "real" size of the whole things involved, increase the size/space. I correct myself, I'm just talking about disk space. As I can understand from the doc, because scaled_float its backed by a long, the the limits that you can store depends of your scaling_factor, the range are between MIN_VALUE_SUPPORTED_FOR_LONG/scaling_factor and MAX_VALUE_SUPPORTED_FOR_LONG/scaling_factor. Mar 11, 2021 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.