File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
server/src/main/java/org/elasticsearch/cluster/metadata Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 99package org .elasticsearch .cluster .metadata ;
1010
1111import org .apache .lucene .document .LongPoint ;
12+ import org .apache .lucene .index .DocValuesSkipIndexType ;
13+ import org .apache .lucene .index .DocValuesSkipper ;
14+ import org .apache .lucene .index .FieldInfo ;
1215import org .apache .lucene .index .LeafReader ;
1316import org .apache .lucene .index .PointValues ;
1417import org .elasticsearch .ElasticsearchException ;
@@ -84,6 +87,12 @@ public static boolean isFailureStoreFeatureFlagEnabled() {
8487 // Timeseries indices' leaf readers should be sorted by desc order of their timestamp field, as it allows search time optimizations
8588 public static final Comparator <LeafReader > TIMESERIES_LEAF_READERS_SORTER = Comparator .comparingLong ((LeafReader r ) -> {
8689 try {
90+ FieldInfo info = r .getFieldInfos ().fieldInfo (TIMESTAMP_FIELD_NAME );
91+ if (info .docValuesSkipIndexType () == DocValuesSkipIndexType .RANGE ) {
92+ DocValuesSkipper skipper = r .getDocValuesSkipper (TIMESTAMP_FIELD_NAME );
93+ return skipper .maxValue ();
94+ }
95+
8796 PointValues points = r .getPointValues (TIMESTAMP_FIELD_NAME );
8897 if (points != null ) {
8998 byte [] sortValue = points .getMaxPackedValue ();
You can’t perform that action at this time.
0 commit comments