Java Client - Class Specification

The new Java Client requires a Java Class to specify the fields to be returned from a search request. I have reviewed the github pull request for Adding new generic client, #417 (Adding new generic client by harshavamsi · Pull Request #415 · opensearch-project/opensearch-java · GitHub) and #377 ([FEATURE] Enable Generic HTTP Actions in Java Client · Issue #377 · opensearch-project/opensearch-java · GitHub). Its not clear to me if this client will ultimately support specifying the return fields as currently provided by HLRC.

{ “size”: 1000, “query”: { “bool”: { “filter”: [ { “term”: { “module”: { “value”: “ncs”, “boost”: 1 } } } ], “adjust_pure_negative”: true, “boost”: 1 } }, “_source”: { “includes”: [ “module”, “descp”, “_id” ], “excludes”: }, “sort”: [ { “module”: { “order”: “asc” } } ] }

I would like to know if the new generic client will support json requests that specify _source “includes” or “excludes” as an option to defining the return fields via a Java class, and if a generic client is planned before HLRC support is removed in the 4.0 release. This approach would remove the need to filter out unwanted class fields and reduce bandwidth costs over time as well.

In #415 (Adding new generic client), a pull request by @harshavamia was marked as Draft on April 13th. The proposed sample was:

OpenSearchHttpClient httpClient = new OpenSearchHttpClient(transport); GetHttpRequest getHttpRequest = new GetHttpRequest.Builder().path(“/movies”).build();

try { JsonReader jsonReader = Json.createReader(new StringReader(httpClient.get(getHttpRequest))); JsonObject object = jsonReader.readObject(); System.out.println(object.toString()); } catch (OpenSearchException e) { e.printStackTrace(); }

Is this draft under consideration for inclusion in the 3.0 release?

For additional background, I saw this related post elasticsearch - Is there a way to do Raw JSON Requests using the Opensearch Java Client? - Stack Overflow

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.