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

Use scaled_floats for percentages in ES mapping #2156

Merged
merged 1 commit into from
Aug 2, 2016

Conversation

tsg
Copy link
Contributor

@tsg tsg commented Aug 2, 2016

Elasticsearch has recently added scaled_float as an option for storing floating
point numbers. The scaled floats are stored internally as longs, which means
they can take advantage of the integer compression in Lucene. See
elastic/elasticsearch#19264 for details.

The PR moves all percentages to scaled floats. In our fields.yml we assume a
default scaling factor of 1000, which should work well for our percentages
(values between 0 and 1). This scaling factor can also be set to a different
value in fields.yml.

@tsg tsg added in progress Pull request is currently in progress. review labels Aug 2, 2016
field["type"] = "float"

properties[field["name"]] = {
"type": field.get("type")
}

if field["type"] == "scaled_float":
properties[field["name"]]["scaling_factor"] = \
field.get("scaling_factor", 1000)
Copy link
Member

Choose a reason for hiding this comment

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

Nice

Elasticsearch has recently added scaled_float as an option for storing floating
point numbers. The scaled floats are stored internally as longs, which means
they can take advantage of the integer compression in Lucene. See
elastic/elasticsearch#19264 for details.

The PR moves all percentages to scaled floats. In our `fields.yml` we assume a
default scaling factor of 1000, which should work well for our percentages
(values between 0 and 1). This scaling factor can also be set to a different
value in `fields.yml`.
@tsg tsg removed the in progress Pull request is currently in progress. label Aug 2, 2016
@ruflin
Copy link
Member

ruflin commented Aug 2, 2016

Flaky appveyor test should be fixed in #2156

@ruflin
Copy link
Member

ruflin commented Aug 2, 2016

LGTM

@ruflin ruflin merged commit 4809f35 into elastic:master Aug 2, 2016
@tsg tsg deleted the use_scaled_float branch August 25, 2016 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants