Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding docs about scaled_float saturation with long values #107966

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/reference/mapping/types/numeric.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,19 @@ numeric field can't be both a time series dimension and a time series metric.
of `scaling_factor` improve accuracy but also increase space requirements.
This parameter is required.

[[scaled-float-saturation]]
==== `scaled_float` Saturation
benwtrent marked this conversation as resolved.
Show resolved Hide resolved

`scaled_float` is backed by a single `long` value. Meaning, the scaling factor
and the value are multiplied and stored as a `long`. If the multiplication
benwtrent marked this conversation as resolved.
Show resolved Hide resolved
results in a value that is outside the range of a `long`, the value is saturated
to the minimum or maximum value of a `long`. For example, if the scaling factor
is +100+ and the value is +92233720368547758.08+, the expected value might be +9223372036854775808+.
benwtrent marked this conversation as resolved.
Show resolved Hide resolved
However, the value actually stored is +9223372036854775807+, the maximum value for a `long`.
benwtrent marked this conversation as resolved.
Show resolved Hide resolved

This can lead to unexpected results with <<query-dsl-range-query,range queries>>
when the scaling factor is large or the value is close to the maximum value of a `long`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unclear whether value here is the scaled float or the original value before scaling. assume the former, so maybe we should say resulting scaled value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adjusted, what do you think? I mean the provided value, not the stored one. If the stored one is "near" the maximum, who cares, its all about when it exceeds the maximum.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes more sense - thanks!

benwtrent marked this conversation as resolved.
Show resolved Hide resolved

[[numeric-synthetic-source]]
==== Synthetic `_source`

Expand Down
Loading