opensearch-project / opensearch-java

Java Client for OpenSearch
Apache License 2.0
118 stars 182 forks source link

[BUG] High Level Rest Client Docs #579

Open SaranSundar opened 1 year ago

SaranSundar commented 1 year ago

What is the bug?

The docs say The OpenSearch Java high-level REST client lets you interact with your OpenSearch clusters and indexes through Java methods and data structures rather than HTTP methods and JSON.

But isn't the point of the rest client to use http methods with json?

Also i'm confused on this warning

The OpenSearch Java high-level REST client will be deprecated starting with OpenSearch version 3.0.0 and will be removed in a future release. We recommend switching to the [Java client](https://opensearch.org/docs/2.8/clients/java/) instead.

Does the java client have a way to make rest calls where you can pass in json, or is the ability to make rest calls to opensearch blocked after v3?

Will there still be a low level rest client exposed somewhere something similar to https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low-usage-initialization.html ?

wbeckler commented 1 year ago

There is an open issue to allow for more generic requests, and json would work there: https://github.com/opensearch-project/opensearch-java/issues/377

wbeckler commented 1 year ago

Also, someone just reopened this: https://github.com/opensearch-project/opensearch-java/issues/525

wbeckler commented 1 year ago

Between these two approaches (generic requester vs json-to-object), which would be more useful to your use case? It would be great if you could comment on one or the other of those issues to add weight to the proposals.

SaranSundar commented 1 year ago

Yah similar to mentioned in that

my teams normal workflow would be use kibana to create some query that could combine multiple filters aggregations etc

and then we have custom java code that allows for easily constructing that same json input

essentially we can either send the raw json or create the json request through code to any opensearch endpoint such as /search or even something like

POST /_sql?format=txt { "query": "SELECT * FROM schoollist WHERE start_date < '2000-01-01'" }

essentially the current high level rest client allows for being able to make any request that we can construct in kibana which is very useful.

I would like for whatever future library to give the same level of access to go from request in kibana to request in app with just the endpoint and json. Anything I can do in kibana i should be able to do by making the same request in my app.