Skip to content

scaled_float still has precision problem #32570

@kyreddie

Description

@kyreddie

Reproduced on Elasticsearch version 6.3.2 in Elastic Cloud

Looks like this was addressed in [https://github.com//pull/27207] but problem still exists.

Steps to reproduce:

PUT testindex{
"settings":{
"number_of_shards":1
},
"mappings":{
"type1":{
"properties":{
"field1":{
"type":"scaled_float",
"scaling_factor":100
}
}
}
}
}

PUT /testindex/type1/1?pretty{
"field1":79.99
}

GET testindex/_search{
"query":{
"bool":{
"must":[
{
"range":{
"field1":{
"gte":0,
"lte":79.99
}
}
}
]
}
}
}

Query results in 0 hits. Looks like the query is being resolved to field1:[0 TO 7998], which is incorrect. I would expect to return document

Looking at the code, could we cast dValue to a float?? hi = Math.round(Math.floor((float)dValue));

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions