Skip to content

Error when handle Decimal data #37846

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

Closed
cuongitbk opened this issue Jan 25, 2019 · 2 comments
Closed

Error when handle Decimal data #37846

cuongitbk opened this issue Jan 25, 2019 · 2 comments
Assignees
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@cuongitbk
Copy link

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
}
}

@jimczi jimczi added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types labels Jan 25, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

@jimczi
Copy link
Contributor

jimczi commented Jan 25, 2019

This looks similar to #32888. @mayya-sharipova can you take a look ?

@jtibshirani jtibshirani self-assigned this Jun 4, 2019
jtibshirani added a commit that referenced this issue Jun 13, 2019
This PR proposes to model big integers as longs (and big decimals as doubles)
in the context of dynamic mappings.

Previously, the dynamic mapping logic did not recognize big integers or
decimals, and would an error of the form "No matching token for number_type
[BIG_INTEGER]" when a dynamic big integer was encountered. It now accepts these
numeric types and interprets them as 'long' and 'double' respectively. This
allows `dynamic_templates` to accept and and remap them as another type such as
`keyword` or `scaled_float`.

Addresses #37846.
jtibshirani added a commit that referenced this issue Jun 14, 2019
This PR proposes to model big integers as longs (and big decimals as doubles)
in the context of dynamic mappings.

Previously, the dynamic mapping logic did not recognize big integers or
decimals, and would an error of the form "No matching token for number_type
[BIG_INTEGER]" when a dynamic big integer was encountered. It now accepts these
numeric types and interprets them as 'long' and 'double' respectively. This
allows `dynamic_templates` to accept and and remap them as another type such as
`keyword` or `scaled_float`.

Addresses #37846.
@javanna javanna added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

5 participants