-
Notifications
You must be signed in to change notification settings - Fork 23
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 OpenSearch-Java transport as an option #124
Comments
@wbeckler @VachaShah @nknize @dblock would love any feedback. |
I'll dig deeper but my initial reaction would be to refactor the java client transport as a core library so we take the dependency on |
I think opensearch-java needs the ability and expose doing pure HTTP requests to avoid being a bottlebeck, and all the implementations of actual strongly typed methods should use those. For this client, taking a dependency on opensearch-java seems like the right call. |
@harshavamsi what is preventing us to use the |
Yes, I wasn't very sure if we should be using typed request/responses given that the hadoop client today does not have any way of determining the types of API calls that are made. Based on the comments from opensearch-project/opensearch-java#377, I think it's fair on both clients to have this feature. This makes it much easier to implement the client here. What were you think about doing in opensearch-project/spring-data-opensearch#19? Were you going to pull in the request/response types from |
Yes, the plan going forward is to recommend |
Is your feature request related to a problem?
Currently the hadoop client uses it’s own custom RestClient to make requests to an OpenSearch cluster. While this works today, we’d like to allow users to choose between that and an optional ApacheHttpClient5Transport that’s present in the OpenSearch-Java client. To do this, we would need to add a new transport option and import the java client into hadoop.
Adding the OpenSearch-Java transport as an option allows us to build on top of the upstream client and allows us to and new features like backpressure awareness and others described in opensearch-project/opensearch-clients#27
What solution would you like?
This diagram illustrates how the java client and hadoop client make requests to OpenSearch today:
The hadoop client just translates incoming queries into a SimpleHTTP request and uses the URL, path, queryparameter, method, and headers to construct the request. OpenSearch-Java on the other hand makes use of a Request/Response builder pattern and exposes those methods to the client.
Approach 1
One approach would be to add a new abstraction layer in OpenSearch-Java that would abstract away the GET/POST/PUT/DELETE methods. The hadoop client can just use the appropriate class, construct the request and let the java client handle everything else. This is also an ask here — opensearch-project/opensearch-java#377
Pros:
Cons:
Approach 2
Parse the incoming request at the hadoop layer and use the appropriate OpenSearch-Java request and response class to send the request.
Implementation questions:
Example design pattern:
Bytesequence
that hadoop uses for the body into either JSON or a body class?Potential example to convert
ByteSequence
to StringPotential example to convert Json string to required JsonData that
.document()
from the Java Client accepts.A bigger question is, what have I missed in the implementation of the Java client and the hadoop client that would require a third approach?
Do you have any additional context?
This is also a feature request in opensearch-project/spring-data-opensearch#19 and can help consolidate the approaches.
The text was updated successfully, but these errors were encountered: