Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add ability to pass ClusterStateRequest object when requesting Cluster State #354

Open
dbwiddis opened this issue Jan 23, 2023 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@dbwiddis
Copy link
Member

Is your feature request related to a problem?

Current SDK implementation of getting cluster state is implemented with defaults in the ExtensionRequest fetching the state from the ClusterService:

    TransportResponse handleExtensionRequest(ExtensionRequest extensionRequest) throws Exception {
        switch (extensionRequest.getRequestType()) {
            case REQUEST_EXTENSION_CLUSTER_STATE:
                return new ClusterStateResponse(clusterService.getClusterName(), clusterService.state(), false);

This does not work for use cases where the specific values to be returned are configured, such as in the AD Plugin:

        ClusterStateRequest clusterStateRequest = new ClusterStateRequest()
            .clear()
            .indices(AnomalyDetectionIndices.ALL_AD_RESULTS_INDEX_PATTERN)
            .metadata(true)
            .local(true)
            .indicesOptions(IndicesOptions.strictExpand());

        adminClient.cluster().state(clusterStateRequest, ActionListener.wrap(clusterStateResponse -> {

What solution would you like?

Either create a new transport action or modify the existing cluster state request action to take a ClusterStateRequest object as a parameter. The RestClusterStateAction class can probably called using the opensearch-java client with little overhead.

What alternatives have you considered?

Improving RestHighLevelClient to handle this case. Not desirable as it's on a path for deprecation.

Do you have any additional context?

This is part of the AnomalyDetectionIndices component in the AD plugin.

@dbwiddis
Copy link
Member Author

dbwiddis commented Apr 10, 2023

The RestClusterStateAction class can probably called using the opensearch-java client with little overhead.

No, it can't. Don't even try. I did, and failed gloriously. See #667

There's a TransportAction and the requests are writeable. This is trivial using transport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants