During the development and review process of the disk health indicator we noticed that it was hard to understand. Since we learnt a lot from the first round of development we want to go through the code one more time and restructure it.
server/src/main/java/org/elasticsearch/health/node/DiskHealthIndicatorService.java
"Please add capacity to the current nodes, or replace them with ones with higher capacity.",
                        "https://ela.st/fix-disk-space"
                    ),
                    Stream.concat(redNonDataNonMasterNodes.stream(), yellowNonDataNonMasterNodes.stream()).sorted().toList()
                )
            );
        }
        return diagnosisList;
    }
    
    static Set<String> getNodeIdsReportingStatus(Map<String, DiskHealthInfo> diskHealthInfoMap, HealthStatus status) {
        return diskHealthInfoMap.entrySet()
            .stream()
            .filter(entry -> status.equals(entry.getValue().healthStatus()))
            .map(Map.Entry::getKey)
            .collect(Collectors.toSet());
    }
    
    static Set<DiscoveryNodeRole> getRolesOnNodes(Set<String> nodeIds, ClusterState clusterState) {
        return clusterState.nodes()
            .getNodes()
            .values()
            .stream()
            .filter(node -> nodeIds.contains(node.getId()))
            .map(DiscoveryNode::getRoles)
            .flatMap(Collection::stream)
            .collect(Collectors.toSet());
    }
    
    static Set<String> getNodesWithDataRole(Set<String> nodeIds, ClusterState clusterState) {