-
Notifications
You must be signed in to change notification settings - Fork 49
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 guide for using raw JSON REST requests with low-level client. #406
Added guide for using raw JSON REST requests with low-level client. #406
Conversation
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 start.
- Remove any usage of higher level classes that aren't raw request/response.
- Write a working sample and put it into
samples
so we can make sure this code works.
@dblock @Xtansia If I'm not mistaken, this .NET client repo does not currently have a "samples" directory like the Python client does. Should I create that new directory here and place my working sample in that location? Or should I just attach the sample in the same "guides" directory where the MD files live? |
Please create one! |
e4d1de2
to
9991b1d
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.
Looks better! Would format text a bit in json.md.
Add a link from USERS_GUIDE to this guide too?
Will leave this for a proper CR for @Xtansia or someone who's a maintainer here. I would check that these examples properly throw errors.
Hey @Xtansia, would you like me to add a link to this guide in the |
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.
@Djcarrillo6 A few points:
- Rather than using
new CancellationToken()
you should useCancellationToken.None
- The sample code should get added to a new project so that it actually gets compiled
- As far as linking the guide, I think we should add an
Advanced Features
section like some of the other clients have: https://github.com/opensearch-project/opensearch-py/blob/main/USER_GUIDE.md#advanced-features
@Xtansia what would adding the sample to a new project entail? Could I just add the sample file to the
@Xtansia Can you detail how would I would correctly add this sample to a new project within the repo? |
@Djcarrillo6 You can create and add a new project with the dotnet new console -o samples/Samples
dotnet sln add samples/Samples |
9991b1d
to
cc3e190
Compare
cc3e190
to
6e38e9f
Compare
6e38e9f
to
f8ca895
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.
Let's make a subfolder for the sample and call it "RawJsonSample"?
number_of_shards = 4 | ||
} | ||
} | ||
}; |
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 there a JSON/string version of this? Not sure what's best for this example, maybe both?
f8ca895
to
8584657
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.
If you're using a string body, you should use PostData.String
rather than PostData.Serializable
. The guide examples need to be updated to match the sample code. It'd be good to add a section to the guide informing users about the different types of PostData
they can use with examples.
Signed-off-by: Djcarrillo6 <[email protected]> Added sample for using raw JSON REST requests with low-level client. Signed-off-by: Djcarrillo6 <[email protected]> Added sample for using raw JSON REST requests with low-level client opensearch-project#2 Signed-off-by: Djcarrillo6 <[email protected]> Created new samples project & PR review changes. Signed-off-by: Djcarrillo6 <[email protected]> Aligned action examples with Python guide. Signed-off-by: Djcarrillo6 <[email protected]> PR change requests. Signed-off-by: Djcarrillo6 <[email protected]> Changed to raw JSON in sample code. Signed-off-by: Djcarrillo6 <[email protected]> Added new section to the guide for using PostData.Serializable() Signed-off-by: Djcarrillo6 <[email protected]>
8584657
to
c7360b2
Compare
@Xtansia I made the change to PostData.String and added a section to the guide informing users about the different |
Signed-off-by: Thomas Farr <[email protected]>
Signed-off-by: Thomas Farr <[email protected]>
Looking at how this is done in the .NET client, would aliasing |
Description
Adds a new guide that demonstrates how to interact with the OpenSearch REST API using the OpenSearch .NET low-level client by executing raw JSON REST requests. It covers a number of operations such as setting up an OpenSearch instance, indexing document data, and executing CRUD operations (CREATE, READ, UPDATE and DELETE) on documents in the index.
Issues Resolved
Resolves issue 403
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.