Skip to content

Commit

Permalink
Adding docs about scaled_float saturation with long values (elastic#1…
Browse files Browse the repository at this point in the history
…07966)

(cherry picked from commit 67748cf)
  • Loading branch information
benwtrent committed Apr 30, 2024
1 parent 735c6f9 commit d961c02
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/reference/mapping/types/numeric.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,16 @@ numeric field can't be both a time series dimension and a time series metric.
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-saturation]]
==== `scaled_float` saturation

`scaled_float` is stored as a single `long` value, which is the product of multiplying the original value by the scaling factor. If the multiplication
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 is +9223372036854775808+.
However, the value that is stored is +9223372036854775807+, the maximum value for a `long`.

This can lead to unexpected results with <<query-dsl-range-query,range queries>>
when the scaling factor or provided `float` value are exceptionally large.

0 comments on commit d961c02

Please sign in to comment.