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

[BUG] Generic HTTP CLient not working with the AwsSdk2Transport #970

Closed
BrendonFaleiro opened this issue May 6, 2024 · 3 comments
Closed
Labels
bug Something isn't working untriaged

Comments

@BrendonFaleiro
Copy link
Contributor

What is the bug?

This bug is in feature: #377 where the generic Http actions are enabled. When I try to send the request, I get an Unhandled endpoint type: 'org.opensearch.client.opensearch.generic.OpenSearchGenericClient$GenericEndpoint' error.

This issue is similar to #969. As mentioned there:

One reason can be, as I see is that in the PR: https://github.com/opensearch-project/opensearch-java/pull/910/files , the changes are done to RestClientTransport.java and ApacheHttpClient5Transport.java , but the changes to AwsSdk2Transport is not done.

How can one reproduce the bug?

    private String searchWithGenericClient(OpenSearchClient openSearchClient) throws IOException {
        Response response = openSearchClient.generic()
                .execute(
                        Requests.builder()
                                .endpoint("/" + {index} + "/_search")
                                .method("POST")
                                .json("{"
                                        + "    \"query\": {"
                                        + "        \"match_all\": {}"
                                        + "    }"
                                        + "}"
                                )
                                .build()
                );
            return response.getBody().get().bodyAsString();
    }

Dependency (openesearch-java v2.10.1):

       <dependency>
            <groupId>org.opensearch.client</groupId>
            <artifactId>opensearch-java</artifactId>
            <version>2.10.1</version>
        </dependency>

Output:

org.opensearch.client.transport.TransportException: Unhandled endpoint type: 'org.opensearch.client.opensearch.generic.OpenSearchGenericClient$GenericEndpoint'
at org.opensearch.client.transport.aws.AwsSdk2Transport.parseResponse(AwsSdk2Transport.java:527) ~[opensearch-java-2.10.1.jar:?]
at org.opensearch.client.transport.aws.AwsSdk2Transport.executeSync(AwsSdk2Transport.java:396) ~[opensearch-java-2.10.1.jar:?]
at org.opensearch.client.transport.aws.AwsSdk2Transport.performRequest(AwsSdk2Transport.java:193) ~[opensearch-java-2.10.1.jar:?]
at org.opensearch.client.opensearch.generic.OpenSearchGenericClient.execute(OpenSearchGenericClient.java:168) ~[opensearch-java-2.10.1.jar:?]

What is the expected behavior?

We need the generic flow to work for AWS opensearch as well.

Our service currently uses JDK8 and we needed to use the newer client to be compatible with JDK8. We are trying to get the generic client working so that we can use the query strings as created for previous versions.

@BrendonFaleiro BrendonFaleiro added bug Something isn't working untriaged labels May 6, 2024
@dblock
Copy link
Member

dblock commented May 7, 2024

Looks like an exact dup of #969, or is it different?

Any interest in picking this up?

@BrendonFaleiro
Copy link
Contributor Author

Looks like an exact dup of #969, or is it different?

Any interest in picking this up?

This isn't an exact duplicate. In #969 the user gets 403 error. I don't end up with a 403, but I am unable to see the response because there is no support for the Generic Client in the AwsSdk2Transport. I believe @reta has self-assigned #969. I'd like to know if the cause is the same.

@reta
Copy link
Collaborator

reta commented May 7, 2024

@BrendonFaleiro this is a duplicate of #969, thank you

@reta reta closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
None yet
Development

No branches or pull requests

3 participants