opensearch-sdk-java icon indicating copy to clipboard operation
opensearch-sdk-java copied to clipboard

[DISCUSS] Remove dependencies on o.o.client:opensearch-java

Open dbwiddis opened this issue 2 years ago • 1 comments

Is your feature request related to a problem?

Java SDK will have api dependencies on OpenSearchClient (java client) and OpenSearchAsyncClient.

I'm curious why the upstream SDK is planned to take a dependency on the downstream client? I think we should strive for no downstream inheritance in the upstream.

Originally posted by @nknize in https://github.com/opensearch-project/opensearch-sdk-java/issues/616#issuecomment-1485830242

SDKClient does not need to provide clients available to users through external dependencies.

  • This is creating headaches for trying to manage them centrally in SDK while also keeping the ability for users to configure them separately. See #612.
  • This would prevent moving SDK into OpenSearch core by creating a dependency loop. See #616
  • All we are (currently) doing is providing a convenience for users in setting them up. We should avoid doing any more than that.

What solution would you like?

  1. Completely remove initialization of OpenSearchClient and OpenSearchAsyncClient from SDKClient.
  2. Document the steps to create such a client in an extension. The document presented in #610 is probably a good home for a link to such documentation, although the full document might want to live in the Docs subdirectory.
    • The ideal thing to document would be how to instantiate it inside createComponents() so it's available throughout an extension via injection; however we should provide the steps to do it rather than just an "initializeJavaClient()" line of code.

What alternatives have you considered?

Status quo which is becoming increasingly unmaintainable.

Do you have any additional context?

We might consider asking the clients team if we can add a section to their documentation showing how to set up their client for an extension.

dbwiddis avatar Mar 29 '23 23:03 dbwiddis

I think the proposal is spot on. If the SDK itself doesn't need a client, then a 3-liner in the docs that says "pick a client, add a dependency, instantiate the client" should be enough.

dblock avatar Apr 25 '23 18:04 dblock