|
15 | 15 | import org.elasticsearch.index.IndexSettings; |
16 | 16 | import org.elasticsearch.index.analysis.IndexAnalyzers; |
17 | 17 | import org.elasticsearch.index.analysis.NamedAnalyzer; |
| 18 | +import org.elasticsearch.index.mapper.DateFieldMapper.DateFieldType; |
18 | 19 | import org.elasticsearch.inference.InferenceService; |
19 | 20 | import org.elasticsearch.search.lookup.SourceFilter; |
20 | 21 |
|
@@ -530,19 +531,18 @@ public boolean isDataStreamTimestampFieldEnabled() { |
530 | 531 | } |
531 | 532 |
|
532 | 533 | /** |
533 | | - * 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 |
534 | | - * skipper. |
535 | | - * @return {@code true} if contains a timestamp field of type date that has doc values and is either indexed or uses a doc values |
536 | | - * skipper, {@code false} otherwise. |
| 534 | + * If this mapping contains a timestamp field that is of type date, has doc values, and is either indexed or uses a doc values |
| 535 | + * skipper, this returns the field type for it. |
537 | 536 | */ |
538 | | - public boolean hasTimestampField() { |
| 537 | + public DateFieldType getTimestampFieldType() { |
539 | 538 | final MappedFieldType mappedFieldType = fieldTypesLookup().get(DataStream.TIMESTAMP_FIELD_NAME); |
540 | | - if (mappedFieldType instanceof DateFieldMapper.DateFieldType dateMappedFieldType) { |
| 539 | + if (mappedFieldType instanceof DateFieldType dateMappedFieldType) { |
541 | 540 | IndexType indexType = dateMappedFieldType.indexType(); |
542 | | - return indexType.hasPoints() || indexType.hasDocValuesSkipper(); |
543 | | - } else { |
544 | | - return false; |
| 541 | + if (indexType.hasPoints() || indexType.hasDocValuesSkipper()) { |
| 542 | + return dateMappedFieldType; |
| 543 | + } |
545 | 544 | } |
| 545 | + return null; |
546 | 546 | } |
547 | 547 |
|
548 | 548 | /** |
|
0 commit comments