diff --git a/server/src/main/java/org/opensearch/indices/IndicesService.java b/server/src/main/java/org/opensearch/indices/IndicesService.java index 2cab59b14dd8e..db5b93f073b03 100644 --- a/server/src/main/java/org/opensearch/indices/IndicesService.java +++ b/server/src/main/java/org/opensearch/indices/IndicesService.java @@ -410,10 +410,8 @@ public IndicesService( this.analysisRegistry = analysisRegistry; this.indexNameExpressionResolver = indexNameExpressionResolver; this.indicesRequestCache = new IndicesRequestCache(settings, (shardId -> { - IndexService indexService = null; - try { - indexService = indexServiceSafe(shardId.getIndex()); - } catch (IndexNotFoundException ex) { + IndexService indexService = this.indices.get(shardId.getIndex().getUUID()); + if (indexService == null) { return Optional.empty(); } return Optional.of(new IndexShardCacheEntity(indexService.getShard(shardId.id())));