Skip to content

Commit 95d3c21

Browse files
authored
Acquire stats searcher for data stream stats (#117953) (#118012)
Backport of #117953 to 7.17 Here, we only need to extract the minimum and maximum values of the timestamp field; therefore, using a stats searcher should suffice. This is important for frozen indices.
1 parent 2dc764d commit 95d3c21

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

docs/changelog/117953.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 117953
2+
summary: Acquire stats searcher for data stream stats
3+
area: Data streams
4+
type: bug
5+
issues: []

docs/changelog/118012.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 118012
2+
summary: Acquire stats searcher for data stream stats
3+
area: Data streams
4+
type: bug
5+
issues: []

x-pack/plugin/data-streams/src/main/java/org/elasticsearch/xpack/datastreams/action/DataStreamsStatsTransportAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.elasticsearch.index.Index;
2929
import org.elasticsearch.index.IndexService;
3030
import org.elasticsearch.index.engine.Engine;
31+
import org.elasticsearch.index.engine.ReadOnlyEngine;
3132
import org.elasticsearch.index.shard.IndexShard;
3233
import org.elasticsearch.index.shard.ShardNotFoundException;
3334
import org.elasticsearch.index.store.StoreStats;
@@ -151,7 +152,7 @@ protected void shardOperation(
151152
IndexAbstraction.DataStream dataStream = indexAbstraction.getParentDataStream();
152153
assert dataStream != null;
153154
long maxTimestamp = 0L;
154-
try (Engine.Searcher searcher = indexShard.acquireSearcher("data_stream_stats")) {
155+
try (Engine.Searcher searcher = indexShard.acquireSearcher(ReadOnlyEngine.FIELD_RANGE_SEARCH_SOURCE)) {
155156
IndexReader indexReader = searcher.getIndexReader();
156157
String fieldName = dataStream.getDataStream().getTimeStampField().getName();
157158
byte[] maxPackedValue = PointValues.getMaxPackedValue(indexReader, fieldName);

0 commit comments

Comments
 (0)