Skip to content

Commit 7cd7974

Browse files
committed
Update hasTimestampField() check to consider doc values skipper
1 parent d1ca991 commit 7cd7974

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

server/src/main/java/org/elasticsearch/index/mapper/MappingLookup.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,15 @@ public boolean isDataStreamTimestampFieldEnabled() {
500500
}
501501

502502
/**
503-
* Returns if this mapping contains a timestamp field that is of type date, indexed and has doc values.
504-
* @return {@code true} if contains a timestamp field of type date that is indexed and has doc values, {@code false} otherwise.
503+
* Returns if this mapping contains a timestamp field that is of type date, has doc values, and is either indexed or uses a doc values
504+
* skipper.
505+
* @return {@code true} if contains a timestamp field of type date that has doc values and is either indexed or uses a doc values
506+
* skipper, {@code false} otherwise.
505507
*/
506508
public boolean hasTimestampField() {
507509
final MappedFieldType mappedFieldType = fieldTypesLookup().get(DataStream.TIMESTAMP_FIELD_NAME);
508-
if (mappedFieldType instanceof DateFieldMapper.DateFieldType) {
509-
return mappedFieldType.isIndexed() && mappedFieldType.hasDocValues();
510+
if (mappedFieldType instanceof DateFieldMapper.DateFieldType dateMappedFieldType) {
511+
return dateMappedFieldType.hasDocValues() && (dateMappedFieldType.isIndexed() || dateMappedFieldType.hasDocValuesSkipper());
510512
} else {
511513
return false;
512514
}

0 commit comments

Comments
 (0)