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
.state(
                clusterStateRequest,
                new RestToXContentListener<RestClusterGetSettingsResponse>(channel).map(
                    response -> response(response.getState(), renderDefaults, settingsFilter, clusterSettings, settings)
                )
            );
    }
    @Override
    protected Set<String> responseParams() {
        return Settings.FORMAT_PARAMS;
    }
    @Override
    public boolean canTripCircuitBreaker() {
        return false;
    }
    static RestClusterGetSettingsResponse response(
        final ClusterState state,
        final boolean renderDefaults,
        final SettingsFilter settingsFilter,
        final ClusterSettings clusterSettings,
        final Settings settings
    ) {
        return new RestClusterGetSettingsResponse(
            settingsFilter.filter(state.metadata().persistentSettings()),
            settingsFilter.filter(state.metadata().transientSettings()),
            renderDefaults ? settingsFilter.filter(clusterSettings.diff(state.metadata().settings(), settings)) : Settings.EMPTY
        );
    }
}