Skip to content

scaled_float has precision problem #27189

@donvanf

Description

@donvanf

Describe the feature:

Elasticsearch version (bin/elasticsearch --version):
5.0.1, Build: 080bb47/2016-11-11T22:08:49.812Z

Plugins installed: []

JVM version (java -version):
1.8.0_131
OS version (uname -a if on a Unix-like system):
CentOS release 6.5
Description of the problem including expected versus actual behavior:
Results from inner_hits named "a" should be returned only if my_parent's key equal 3.
Steps to reproduce:

Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.

PUT test
{
  "mappings": {
    "type": {
      "properties": {
        "scaled_float_field": {
          "type": "scaled_float",
          "scaling_factor": 100
        }
      }
    }
  }
}
POST _bulk
{"update": {"_index": "test","_type": "type","_id": "1"}}
{"doc": {"scaled_float_field": 0.1},"doc_as_upsert": true}
POST test/_search
{
  "query": {
    "range": {
      "scaled_float_field": {
        "lt": 0.1
      }
    }
  }
}

result

{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 1,
    "hits": [
      {
        "_index": "test",
        "_type": "type",
        "_id": "1",
        "_score": 1,
        "_source": {
          "scaled_float_field": 0.1
        }
      }
    ]
  }
}

As Document mentions here, scaled_float is stored as long type. Why it also has precision problem?

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