-
Notifications
You must be signed in to change notification settings - Fork 190
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
Low-level Java client #905
Comments
If you don't want to serialize/deserialize, any HTTP client can help you make HTTPs raw JSON requests, apache http client, etc. (https://stackoverflow.com/questions/1359689/how-to-send-http-request-in-java). There's nothing really special about OpenSearch as a web server. Better raw JSON support in this client is #257 and #377, closing this one as a dup. |
@dblock Here's the simplified code:
Things to note
What could I be missing here? |
I believe Want to put a project up similar to https://github.com/dblock/opensearch-java-client-demo that has a working sample for regular search like the one above, and a non-working one for msearch? I can try to fix it. |
Please find the sample Kotlin code below... Apache HTTP client config:
OpenSearchClient config:
MsearchRequest creation:
Working test:
Failing tests:
|
I don't see anything wrong. Could you please make a new GitHub repo with working code that I can |
Thanks a lot! I have put all the sample code in this test class which you can just simply execute as 3 different tests. Apologies for not being able to create a repo (as I won't be able to push/upload the code from my company's network).
UPDATE: pom.xml
|
Signed-off-by: dblock <dblock@amazon.com>
@RGB314 Your code is missing |
@RGB314 the code is trying to convert the multiple lines of JSON (line-delimited JSON) into a byte array, which is not what the server expects, use a request.entity = StringEntity(query.toString(), ContentType.create("application/json", "UTF-8")); This runs the second test that uses For the first one you need to convert msearchRequest to ldjson like so. Post your code when you have that working. |
@dblock Thanks a lot! |
Quick point on #910: |
@RGB314 Right, this is pure JSON in JSON out. |
Is your feature request related to a problem?
Java client - OpenSearch Documentation says…
What solution would you like?
So is there another (low-level) client which would allow me to interact with raw JSON requests and responses?
What alternatives have you considered?
Not available
Do you have any additional context?
I'd like to search where this API client will help in improving latency by avoiding serialisation and deserialisation.
The text was updated successfully, but these errors were encountered: