Skip to content

Commit e6d3f46

Browse files
authored
Add NumericType.Date to missingObject Method
1 parent 8b9cbca commit e6d3f46

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/main/java/org/elasticsearch/index/fielddata/fieldcomparator/LongValuesComparatorSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ protected long docValue() {
152152

153153
@Override
154154
public Object missingObject(Object missingValue, boolean reversed) {
155-
if (targetNumericType == NumericType.DATE_NANOSECONDS) {
155+
if (targetNumericType == NumericType.DATE_NANOSECONDS || targetNumericType == NumericType.DATE) {
156156
// special case to prevent negative values that would cause invalid nanosecond ranges
157157
if (sortMissingFirst(missingValue) || sortMissingLast(missingValue)) {
158158
final boolean min = sortMissingFirst(missingValue) ^ reversed;
159-
return min ? 0L : DateUtils.MAX_NANOSECOND;
159+
return min ? 0L : targetNumericType == IndexNumericFieldData.NumericType.DATE_NANOSECONDS ? DateUtils.MAX_NANOSECOND : Long.MAX_VALUE;
160160
}
161161
}
162162
return super.missingObject(missingValue, reversed);

0 commit comments

Comments
 (0)