Elasticsearch version: 7.6+
Description of the problem including expected versus actual behavior:
I am not entirely sure what exactly the problem is, but there is some parsing logic with rounding dates up that causes parsing exceptions that do not look like they should be parsing exceptions.
I've written a unit test in JavaDateMathParserTests.java that reproduces the believed issue:
public void testInvalidAMPM() {
DateFormatter formatter = DateFormatter.forPattern("MM/dd/yyyy hh:mm a");
DateMathParser parser = formatter.toDateMathParser();
String date = "04/30/2020 05:48 PM";
parser.parse(date, () -> 0, false, ZoneId.systemDefault());
ElasticsearchParseException exception = expectThrows(ElasticsearchParseException.class,
() -> parser.parse(date, () -> 0, true, ZoneId.systemDefault()));
}
when roundUpProperty is set to true, parsing fails.
Steps to reproduce:
PUT my_index
{
"mappings": {
"properties": {
"date": {
"type": "date",
"ignore_malformed" : false,
"format" : "MM/dd/yyyy hh:mm a z"
}
}
}
}
PUT my_index/_doc/1
{
"date": "04/02/2020 07:48 AM CST"
}
GET my_index/_search
{
"query": {
"range": {
"date": {
"gte": "04/01/2020 07:48 AM CST",
"lte": "04/20/2020 05:48 PM CST"
}
}
}
}
might be related to #46654 cc @pgomulka
Elasticsearch version: 7.6+
Description of the problem including expected versus actual behavior:
I am not entirely sure what exactly the problem is, but there is some parsing logic with rounding dates up that causes parsing exceptions that do not look like they should be parsing exceptions.
I've written a unit test in
JavaDateMathParserTests.javathat reproduces the believed issue:when
roundUpPropertyis set to true, parsing fails.Steps to reproduce:
might be related to #46654 cc @pgomulka