Skip to content

Error when handle Decimal data #37846

@cuongitbk

Description

@cuongitbk

ElasticSearch Docker 6.5.4
Linux

  1. Create dynamic template using scaled_float type

{
"balance": {
"match": "balance",
"mapping": {
"scaling_factor": 100,
"type": "scaled_float"
}
}
}

  1. Post new instance with very big number

POST /tokens/doc/1
{
"balance": 18000000000000000000000000000000000000000000000
}

ElasticSearch throw error:

{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse",
"caused_by": {
"type": "illegal_state_exception",
"reason": "No matching token for number_type [BIG_INTEGER]"
}
},
"status": 400
}

  1. Post another data using string type, then delete this item and finally post data from step 2. ElasticSearch worked well and index right data
    3.1. Post string data

POST /tokens/doc/1
{
"balance": "18000000000000000000000000000000000000000000000"
}

{
"_index": "tokens",
"_type": "doc",
"_id": "1",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
}

3.2. Delete this record and post data from step 2
{
"_index": "tokens",
"_type": "doc",
"_id": "1",
"_version": 3,
"found": true,
"_source": {
"balance": 1.8e+46
}
}

Metadata

Metadata

Assignees

Labels

:Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions