From 85c230d62b3068ff68ca33ae68f500f39402556d Mon Sep 17 00:00:00 2001 From: bansvaru Date: Thu, 27 Jul 2023 18:15:05 +0530 Subject: [PATCH] Support wildcard/regex for indices param in _remotestore/_restore Signed-off-by: bansvaru --- .../main/java/org/opensearch/snapshots/RestoreService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/snapshots/RestoreService.java b/server/src/main/java/org/opensearch/snapshots/RestoreService.java index d7e89172c5837..693003aec578d 100644 --- a/server/src/main/java/org/opensearch/snapshots/RestoreService.java +++ b/server/src/main/java/org/opensearch/snapshots/RestoreService.java @@ -227,7 +227,12 @@ public ClusterState execute(ClusterState currentState) { List indicesToBeRestored = new ArrayList<>(); int totalShards = 0; - for (String index : request.indices()) { + List filteredIndices = filterIndices( + new ArrayList<>(currentState.metadata().indices().keySet()), + request.indices(), + IndicesOptions.LENIENT_EXPAND_OPEN_HIDDEN + ); + for (String index : filteredIndices) { IndexMetadata currentIndexMetadata = currentState.metadata().index(index); if (currentIndexMetadata == null) { // ToDo: Handle index metadata does not exist case. (GitHub #3457)