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

DateFieldMapper ignore_malformed misses java.lang.ArithmeticException #52634

Closed
iverase opened this issue Feb 21, 2020 · 2 comments · Fixed by #60211
Closed

DateFieldMapper ignore_malformed misses java.lang.ArithmeticException #52634

iverase opened this issue Feb 21, 2020 · 2 comments · Fixed by #60211
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

@iverase
Copy link
Contributor

iverase commented Feb 21, 2020

It seems when parsing dates as longs, we can have arithmetic exceptions. Steps to reproduce:

PUT test01
{
  "mappings": {
    "properties": {
      "dadate": {
        "type": "date",
        "ignore_malformed": true
      }
    }
  }
}
     
PUT test01/_doc/1
{
  "dadate": "-522000000"
}

The error in the logs looks like:

Caused by: java.lang.ArithmeticException: long overflow
	at java.lang.Math.multiplyExact(Math.java:946) ~[?:?]
	at java.lang.Math.multiplyExact(Math.java:922) ~[?:?]
	at java.time.Instant.toEpochMilli(Instant.java:1236) ~[?:?]
	at org.elasticsearch.index.mapper.DateFieldMapper$Resolution$1.convert(DateFieldMapper.java:83) ~[elasticsearch-7.6.0.jar:7.6.0]
	at org.elasticsearch.index.mapper.DateFieldMapper$DateFieldType.parse(DateFieldMapper.java:338) ~[elasticsearch-7.6.0.jar:7.6.0]
	at org.elasticsearch.index.mapper.DateFieldMapper.parseCreateField(DateFieldMapper.java:545) ~[elasticsearch-7.6.0.jar:7.6.0]

Similar to #50090

@iverase iverase added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types labels Feb 21, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@shirleysela
Copy link

Hi, i was having a similiar issue (#52396 (comment)). In cases when the long is 10 digits or shorter it isn't parsed as epoch milliseconds, but to a year

@rjernst rjernst added the Team:Search Meta label for search team label May 4, 2020
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Jul 27, 2020
Currently we occasionally can get ArithmeticException from parsing bad input
values on 'date' fields that are passed on even if 'ignore_malformed' is set.
This change adds this exception to the ones we already catch for malformed
values.

Closes elastic#52634
cbuescher pushed a commit that referenced this issue Aug 17, 2020
Currently we occasionally can get ArithmeticException from parsing bad input
values on 'date' fields that are passed on even if 'ignore_malformed' is set.
This change adds this exception to the ones we already catch for malformed
values.

Closes #52634
cbuescher pushed a commit that referenced this issue Aug 17, 2020
Currently we occasionally can get ArithmeticException from parsing bad input
values on 'date' fields that are passed on even if 'ignore_malformed' is set.
This change adds this exception to the ones we already catch for malformed
values.

Closes #52634
@javanna javanna added Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch and removed Team:Search Meta label for search team labels 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

Successfully merging a pull request may close this issue.

5 participants