-
Notifications
You must be signed in to change notification settings - Fork 176
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
Added client-level REST helpers. #544
Conversation
Codecov Report
@@ Coverage Diff @@
## main #544 +/- ##
==========================================
+ Coverage 71.74% 71.87% +0.12%
==========================================
Files 87 89 +2
Lines 7886 7922 +36
==========================================
+ Hits 5658 5694 +36
Misses 2228 2228
|
4d20438
to
aec5726
Compare
@saimedhi @harshavamsi @Xtansia wdyt? |
1f9b9f1
to
6fdce84
Compare
We're going to have this name clash with |
@Xtansia What's your most preferred option for |
I personally feel like |
Followed suggestion from @Xtansia to make the code |
3ee1b76
to
970a5fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a few minor comments.
guides/json.md
Outdated
@@ -6,61 +6,75 @@ | |||
|
|||
# Making Raw JSON REST Requests | |||
|
|||
The OpenSearch client implements many high-level REST DSLs that invoke OpenSearch APIs. However you may find yourself in a situation that requires you to invoke an API that is not supported by the client. Use `client.transport.perform_request` to do so. See [samples/json](../samples/json) for a complete working sample. | |||
The OpenSearch client implements many high-level REST DSLs that invoke OpenSearch APIs. However you may find yourself in a situation that requires you to invoke an API that is not supported by the client. Use `client.http.get`, `head` , `put`, `post`, and `delete` in older versions to do so. See [samples/json](../samples/json) for a complete working sample. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use client.transport.perform_request
in older versions (<= 2.3.x) and client.http.get
and others in newer versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "in older versions" would be removed from this line: "Use client.http.get
, head
, put
, post
, and delete
to do so"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good eyes, fixed.
# Modifications Copyright OpenSearch Contributors. See | ||
# GitHub history for details. | ||
# | ||
# Licensed to Elasticsearch B.V. under one or more contributor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this header needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because the file was copied.
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
* Added client-level REST helpers. Signed-off-by: dblock <dblock@amazon.com> * Move functions into an .http namespace. Signed-off-by: dblock <dblock@amazon.com> * Poetry update in samples. Signed-off-by: dblock <dblock@amazon.com> * Fix: typo. Signed-off-by: dblock <dblock@amazon.com> * Clarified what to use in which older versions. Signed-off-by: dblock <dblock@amazon.com> --------- Signed-off-by: dblock <dblock@amazon.com> Signed-off-by: roma2023 <romasaparhan19@gmail.com>
Description
Adds client-level REST helpers.
This allows one to do
client.http.get(...)
,.post
, etc., instead ofclient.transport.perform_request("GET", ...)
.Issues Resolved
Closes #498.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.