From e21c5975f2a79bf178e8051b910ae43c14cc14d8 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Mon, 4 Jul 2022 18:04:07 +0200 Subject: [PATCH] Use pre-parsed index mode when figuring out timestamp range (#88254) Use `indexMode` field instead of parsing IndexMode from settings in order to determine time series timestamp range. Parsing the index mode isn't necessary, because we read the index mode when IndexMetadata is constructed, and this just burns unnecessary CPU cycles. --- .../org/elasticsearch/cluster/metadata/IndexMetadata.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java index cd794aa4151f1..bc18e0b697a2c 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadata.java @@ -1006,7 +1006,11 @@ public IndexLongFieldRange getTimestampRange() { */ @Nullable public IndexLongFieldRange getTimeSeriesTimestampRange() { - return IndexSettings.MODE.get(settings).getConfiguredTimestampRange(this); + if (indexMode != null) { + return indexMode.getConfiguredTimestampRange(this); + } else { + return null; + } } @Override