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

[DOCS] Document script_score float precision limit #49402

Merged
merged 2 commits into from
Nov 21, 2019
Merged

[DOCS] Document script_score float precision limit #49402

merged 2 commits into from
Nov 21, 2019

Conversation

jrodewig
Copy link
Contributor

Scores produced by the script_score function are stored as positive, 32-bit floats in the _score field.

This updates an existing admonition in the function score query docs to document the 32-bits of precision limit.

Closes #48845.

Scores produced by the `script_score` function are stored as positive,
32-bit floats in the `_score` field.

This updates an existing admonition to document the 32-bits of precision
limit.
@jrodewig jrodewig added >docs General docs changes :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.6.0 v7.4.3 v6.8.6 v7.5.1 labels Nov 20, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs (>docs)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Search)

Comment on lines 161 to 162
As a result, scores are limited to 32-bits of precision. Larger numbers will
lose precision during storage.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I waiver over whether these sentences are needed. Any feedback appreciated!

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should clarify that all scores are 32-bit floats in Elasticsearch, this is not specific to this query. Then if a script_score produces a value that has greater accuracy than a 32-bit float, it will be automatically converted to the nearest 32-bit float.

Unrelated note: I find the word "storage" possibly confusing since we don't store scores on disk, which is what some users might think this statement implies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @jpountz. Very good point re: store/storage.

I reworded this section as you suggested with 63f714a. I also noted that _score is 32-bit in the Search API reference docs.

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @jrodewig !

@jrodewig jrodewig merged commit 1e45db4 into elastic:master Nov 21, 2019
@jrodewig jrodewig deleted the doc-script-score-precision-limit branch November 21, 2019 13:54
jrodewig added a commit that referenced this pull request Nov 21, 2019
All document scores are positive 32-bit floating point numbers. However, this
wasn't previously documented.

This can result in surprising behavior, such as precision loss, for users when
customizing scores using the function score query.

This commit updates an existing admonition in the function score query docs to
document the 32-bits precision limit. It also updates the search API reference
docs to note that `_score` is a 32-bit float.
jrodewig added a commit that referenced this pull request Nov 21, 2019
All document scores are positive 32-bit floating point numbers. However, this
wasn't previously documented.

This can result in surprising behavior, such as precision loss, for users when
customizing scores using the function score query.

This commit updates an existing admonition in the function score query docs to
document the 32-bits precision limit. It also updates the search API reference
docs to note that `_score` is a 32-bit float.
jrodewig added a commit that referenced this pull request Nov 21, 2019
All document scores are positive 32-bit floating point numbers. However, this
wasn't previously documented.

This can result in surprising behavior, such as precision loss, for users when
customizing scores using the function score query.

This commit updates an existing admonition in the function score query docs to
document the 32-bits precision limit. It also updates the search API reference
docs to note that `_score` is a 32-bit float.
jrodewig added a commit that referenced this pull request Nov 21, 2019
All document scores are positive 32-bit floating point numbers. However, this
wasn't previously documented.

This can result in surprising behavior, such as precision loss, for users when
customizing scores using the function score query.

This commit updates an existing admonition in the function score query docs to
document the 32-bits precision limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Search/Search Search-related issues that do not fall into other categories v6.8.6 v7.4.3 v7.5.1 v7.6.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Score with too many digits gets scrambled in last places
4 participants