Skip to content

Commit 0c4e141

Browse files
authored
Fixing _rollup/data performance for a large number of indices (#138305)
1 parent 279c349 commit 0c4e141

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/changelog/138305.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 138305
2+
summary: Fixing _rollup/data performance for a large number of indices
3+
area: Rollup
4+
type: bug
5+
issues: []

x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportGetRollupIndexCapsAction.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
import java.util.ArrayList;
3131
import java.util.Arrays;
32+
import java.util.Collection;
33+
import java.util.HashSet;
3234
import java.util.List;
3335
import java.util.Map;
3436
import java.util.TreeMap;
@@ -86,11 +88,11 @@ private void doExecuteForked(IndicesRequest request, ActionListener<GetRollupInd
8688
Transports.assertNotTransportThread("retrieving rollup job index caps may be expensive");
8789
final var project = projectResolver.getProjectMetadata(clusterService.state());
8890
String[] indices = resolver.concreteIndexNames(project, request.indicesOptions(), request);
89-
Map<String, RollableIndexCaps> allCaps = getCapsByRollupIndex(Arrays.asList(indices), project.indices());
91+
Map<String, RollableIndexCaps> allCaps = getCapsByRollupIndex(new HashSet<>(Arrays.asList(indices)), project.indices());
9092
listener.onResponse(new GetRollupIndexCapsAction.Response(allCaps));
9193
}
9294

93-
static Map<String, RollableIndexCaps> getCapsByRollupIndex(List<String> resolvedIndexNames, Map<String, IndexMetadata> indices) {
95+
static Map<String, RollableIndexCaps> getCapsByRollupIndex(Collection<String> resolvedIndexNames, Map<String, IndexMetadata> indices) {
9496
Map<String, List<RollupJobCaps>> allCaps = new TreeMap<>();
9597

9698
indices.entrySet().stream().filter(entry -> resolvedIndexNames.contains(entry.getKey())).forEach(entry -> {

0 commit comments

Comments
 (0)