-
Notifications
You must be signed in to change notification settings - Fork 58
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] SDK is not working with OpenSearch 2.x #345
Comments
Stack trace:
|
This is due to opensearch-project/OpenSearch#4459. Seems that for opensearch-sdk-java we'll have to support using Apache HttpClient 4 since that is what the high level rest client is based on for 2.x |
We might need to create a 2.x branch if it is not possible to have support for both at the same time. |
thanks @ryanbogan and @joshpalis. We've updated our client underlying dependency to
Could you try the first option and see where we end up? |
I added the implementations of
|
@ryanbogan do you want to assign this issue to yourself ? |
This is an expected bug. Reason being client has been migrated to HttpClient/Core5.x in 3.x in OpenSearch and opensearch-java. To handle the same we have migrated SDKClient to HttpClient/Core5.x as well since SDK uses OpenSearch 3.0-SNAPSHOT: #231. For 2.x, since OpenSearch still runs on the old client and to make SDK compatible with it the solution I see is:
This is how the client should look like on the new 2.x branch: public OpenSearchClient initializeClient(String hostAddress, int port) throws IOException {
RestClientBuilder builder = RestClient.builder(new HttpHost(hostAddress, port));
builder.setStrictDeprecationMode(true);
builder.setHttpClientConfigCallback(httpClientBuilder -> {
try {
return httpClientBuilder.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
restClient = builder.build();
// Create Client
OpenSearchTransport transport = new RestClientTransport(
restClient,
new JacksonJsonpMapper(new ObjectMapper().registerModule(new JavaTimeModule()))
);
javaClient = new OpenSearchClient(transport);
return javaClient;
} |
The SDK is currently not working on OpenSearch 2.x, because the client library was changed for OpenSearch 3.x. This can be reproduced by changing the
opensearch
variable in the SDKbuild.gradle
file to2.6.0-SNAPSHOT
. The opensearch-java client must be changed to be3.0.0-SNAPSHOT
to avoid a different compile error. Then, run./gradlew helloWorld
, which gives the following error:There are more instances of the same error, but I did not include them.
Edit:
We will be creating a new branch to coincide with the 2.x branch on the OpenSearch repository. The action item for this issue is to ensure that this branch has the same functionality, but with the 2.6.0 snapshot from OpenSearch.
The text was updated successfully, but these errors were encountered: