Skip to content

Commit

Permalink
Stash context to fetch resources from a system index
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Dec 13, 2024
1 parent cabbcd6 commit dc964ac
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,8 @@ public boolean deleteAllRecordsForUser(String name) {
private <T> Set<T> getResourcesFromIds(Set<String> resourceIds, String resourceIndex, Class<T> clazz) {

Set<T> result = new HashSet<>();
try {
// stashing Context to avoid permission issues in-case resourceIndex is a system index
try (ThreadContext.StoredContext ctx = this.threadPool.getThreadContext().stashContext()) {
MultiGetRequest request = new MultiGetRequest();
for (String id : resourceIds) {
request.add(new MultiGetRequest.Item(resourceIndex, id));
Expand Down

0 comments on commit dc964ac

Please sign in to comment.