Similar issue as solved in https://github.com/elastic/elasticsearch/pull/78829.

This API is surprisingly expensive because it requests the full metadata via get cluster state request from master when called only to return just the settings from it to the user. This can mean requesting tens or hundreds of MB from master in a large cluster unexpectedly.

We should adjust this to not require fetching the full cluster state. One option would be to add a dedicate master node action for returning just the settings.

Relates #77466 
server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java
private final Settings settings;
    private final ClusterSettings clusterSettings;
    private final SettingsFilter settingsFilter;
    public RestClusterGetSettingsAction(Settings settings, ClusterSettings clusterSettings, SettingsFilter settingsFilter) {
        this.settings = settings;
        this.clusterSettings = clusterSettings;
        this.settingsFilter = settingsFilter;
    }
    @Override
    public List<Route> routes() {
        return List.of(new Route(GET, "/_cluster/settings"));
    }
    @Override
    public String getName() {
        return "cluster_get_settings_action";
    }
    @Override
    public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
        ClusterStateRequest clusterStateRequest = Requests.clusterStateRequest().routingTable(false).nodes(false);
        final boolean renderDefaults = request.paramAsBoolean("include_defaults", false);
        clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
        clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
        return channel -> client.admin()
            .cluster()