You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/elasticsearch/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java
+17-3Lines changed: 17 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -383,7 +383,7 @@ protected long parseStringValue(String value) {
383
383
longtime = Long.parseLong(value);
384
384
returntimeUnit.toMillis(time);
385
385
} catch (NumberFormatExceptione1) {
386
-
thrownewMapperParsingException("failed to parse date field, tried both date format [" + dateTimeFormatter.format() + "], and timestamp number", e);
386
+
thrownewMapperParsingException("failed to parse date field [" + value + "], tried both date format [" + dateTimeFormatter.format() + "], and timestamp number", e);
387
387
}
388
388
}
389
389
}
@@ -394,14 +394,28 @@ protected long parseUpperInclusiveStringValue(String value) {
// if we did not manage to parse, or the year is really high year which is unreasonable
403
+
// see if its a number
404
+
if (location <= 0 || dateTime.getYear() > 5000) {
405
+
try {
406
+
longtime = Long.parseLong(value);
407
+
returntimeUnit.toMillis(time);
408
+
} catch (NumberFormatExceptione1) {
409
+
thrownewMapperParsingException("failed to parse date field [" + value + "], tried both date format [" + dateTimeFormatter.format() + "], and timestamp number");
410
+
}
411
+
}
398
412
returndateTime.getMillis();
399
413
} catch (RuntimeExceptione) {
400
414
try {
401
415
longtime = Long.parseLong(value);
402
416
returntimeUnit.toMillis(time);
403
417
} catch (NumberFormatExceptione1) {
404
-
thrownewMapperParsingException("failed to parse date field, tried both date format [" + dateTimeFormatter.format() + "], and timestamp number", e);
418
+
thrownewMapperParsingException("failed to parse date field [" + value + "], tried both date format [" + dateTimeFormatter.format() + "], and timestamp number", e);
0 commit comments