-
Notifications
You must be signed in to change notification settings - Fork 185
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 new guide & sample module for using index templates. #531
Added new guide & sample module for using index templates. #531
Conversation
@saimedhi I'm from the OSCI & this is my first time contributing to this repo. I was originally assigned to the .NET client, however after seeing you comment in the #osci-client channel regarding there being many good first issues open on the Python client repo, I requested & received assignment on this issue. I believe my commit only has the four added/modified files associated with the new guide, however this test is referencing a package vulnerability even though I didn't modify anything directly outside of the files in my commit. Can you advise me on how to resolve the issue that caused the WhiteSource Security Check to fail? |
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 good!
Some nits that you may or may not want to fix.
Let's link the working sample from the guide?
guides/index_template.md
Outdated
## Setup | ||
|
||
Assuming you have OpenSearch running locally on port 9200, you can create a client instance | ||
with the following code: |
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.
No need to line-wrap in markdown.
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 have removed the line-wrap from the MD file, and pushed the changes.
guides/index_template.md
Outdated
```python | ||
from opensearchpy import OpenSearch | ||
client = OpenSearch( | ||
hosts=['https://admin:admin@localhost:9200'], |
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.
Separate auth, http_auth=...
, it's not a great practice to include that in the URL.
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 have added the http_auth param and removed "admin:admin" from the hosts param. This change has also been pushed.
8c447a2
to
3806db6
Compare
Codecov Report
@@ Coverage Diff @@
## main #531 +/- ##
=======================================
Coverage 70.72% 70.72%
=======================================
Files 83 83
Lines 7852 7852
=======================================
Hits 5553 5553
Misses 2299 2299 |
@dblock I have made the changes you suggested. Is there anything else you'd like me to address? |
Hello @Djcarrillo6, The WhiteSource Security Check failure isn't related to this PR. However, you can work on that issue next if you prefer. We currently face an issue with the urllib3 version used by opensearch-py. To upgrade to the latest urllib3 version, we must remove end-of-life Python versions from this repository. Relevant issues: #430 |
1cc7a23
to
ba3d76a
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.
Code tested and working
CHANGELOG.md
Outdated
@@ -125,6 +125,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | |||
- Compatibility with OpenSearch 2.1.0 - 2.4.1 ([#257](https://github.com/opensearch-project/opensearch-py/pull/257)) | |||
- Added explicit parameters for `AIOHttpConnection` and `AsyncTransport` ([#276](https://github.com/opensearch-project/opensearch-py/pull/276)) | |||
- Added support for a custom signing service name for AWS SigV4 ([#268](https://github.com/opensearch-project/opensearch-py/pull/268)) | |||
- Added new guide for using index templates with the client ([#351](https://github.com/opensearch-project/opensearch-py/issues/351)) |
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 Please write your PR details instead of issue details in the unreleased - added section
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.
@saimedhi this has been fixed and pushed.
USER_GUIDE.md
Outdated
@@ -153,6 +153,7 @@ print(response) | |||
- [Search](guides/search.md) | |||
- [Point in Time](guides/point_in_time.md) | |||
- [Using a Proxy](guides/proxy.md) | |||
- [Using Index Templates](guides/index_template.md) |
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 only Index Templates is enough :)
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.
@saimedhi This has been fixed and pushed.
ba3d76a
to
ab024cf
Compare
CHANGELOG.md
Outdated
@@ -125,6 +125,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) | |||
- Compatibility with OpenSearch 2.1.0 - 2.4.1 ([#257](https://github.com/opensearch-project/opensearch-py/pull/257)) | |||
- Added explicit parameters for `AIOHttpConnection` and `AsyncTransport` ([#276](https://github.com/opensearch-project/opensearch-py/pull/276)) | |||
- Added support for a custom signing service name for AWS SigV4 ([#268](https://github.com/opensearch-project/opensearch-py/pull/268)) | |||
- Added new guide for using index templates with the client ([#351](https://github.com/opensearch-project/opensearch-py/pull/531)) |
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.
Please change 351 to 531
ab024cf
to
9305a0e
Compare
@Djcarrillo6, sorry 1 final change required as mentioned above please add changelog entry in unreleased added section. Not in 2.0.1 |
Signed-off-by: Djcarrillo6 <[email protected]> Fixed line wrapping & connect params in index_template.md Signed-off-by: Djcarrillo6 <[email protected]> Linked sample code to index_template.md file Signed-off-by: Djcarrillo6 <[email protected]> Fixed broken link in to sample in index_template.md Signed-off-by: Djcarrillo6 <[email protected]> Added http_auth param to the index_template_sample.py module Signed-off-by: Djcarrillo6 <[email protected]> Fixed MD files. Signed-off-by: Djcarrillo6 <[email protected]> Fixed MD files again Signed-off-by: Djcarrillo6 <[email protected]> Fixed MD files again 2 Signed-off-by: Djcarrillo6 <[email protected]>
9305a0e
to
b450075
Compare
@saimedhi Moved my CHANGELOG entry to unreleased section |
If you're interested in fixing the detected security vulnerability, it's a straightforward process. To bump urllib3 to the latest version, simply remove Python version 3.5 from noxfile.py and .github/workflows/test.yml. Before that just comment on this issue #430 saying removing end of life python version because of security vulnerability. Thank you. |
Signed-off-by: Djcarrillo6 <[email protected]> Updated CHANGELOG Signed-off-by: Djcarrillo6 <[email protected]> Updated CHANGELOG & link to sample. Signed-off-by: Djcarrillo6 <[email protected]> updated changelog (opensearch-project#522) Signed-off-by: saimedhi <[email protected]> Bump version to 2.3.2 (opensearch-project#524) Signed-off-by: saimedhi <[email protected]> Fix: typos. (opensearch-project#526) * Fix: typo. Signed-off-by: dblock <[email protected]> * Fix: typo. Signed-off-by: dblock <[email protected]> * Fixed its. Signed-off-by: dblock <[email protected]> * Added Visual Code settings to .gitignore. Signed-off-by: dblock <[email protected]> * Added loop type for async client. Signed-off-by: dblock <[email protected]> --------- Signed-off-by: dblock <[email protected]> Modified generator to generate api deprecation warnings (opensearch-project#527) Signed-off-by: saimedhi <[email protected]> Generate cat client from API specs (opensearch-project#529) Signed-off-by: saimedhi <[email protected]> Generate cluster client from API specs (opensearch-project#530) Signed-off-by: saimedhi <[email protected]> Added new guide & sample module for using index templates. (opensearch-project#531) Added index_template guide and sample Signed-off-by: Djcarrillo6 <[email protected]> Removed EOL Python3.5 & bumped urllib3 version to patch security vulnerability (opensearch-project#533) Updated CHANGELOG with pull # Updated CHANGELOG with pull # Updated CHANGELOG removed section. Updated CHANGELOG removed section again Signed-off-by: Djcarrillo6 <[email protected]> Align pool_maxsize for different connection pool implementations. (opensearch-project#535) * Align pool_maxsize for different connection pool implementations. Signed-off-by: dblock <[email protected]> * Document connection classes and settings. Signed-off-by: dblock <[email protected]> * Undo change in async for backwards compatibility. Signed-off-by: dblock <[email protected]> * Fix: typo. Signed-off-by: dblock <[email protected]> --------- Signed-off-by: dblock <[email protected]> Add micro benchmarks. (opensearch-project#537) * Align pool_maxsize for different connection pool implementations. Signed-off-by: dblock <[email protected]> * Added benchmarks. Signed-off-by: dblock <[email protected]> * Multi-threaded vs. async benchmarks. Signed-off-by: dblock <[email protected]> * Set pool size to the number of threads. Signed-off-by: dblock <[email protected]> * Added sync/async benchmark. Signed-off-by: dblock <[email protected]> * Report client-side latency. Signed-off-by: dblock <[email protected]> * Various updates to benchmarks, demonstrating threading improves throughput. Signed-off-by: dblock <[email protected]> * Bench info. Signed-off-by: dblock <[email protected]> * Fixup format. Signed-off-by: dblock <[email protected]> * Undo async maxsize. Signed-off-by: dblock <[email protected]> * Moved benchmarks folder. Signed-off-by: dblock <[email protected]> * Updated documentation and project description. Signed-off-by: dblock <[email protected]> --------- Signed-off-by: dblock <[email protected]>
…h-project#531) Added index_template guide and sample Signed-off-by: Djcarrillo6 <[email protected]>
Description:
Added a new guide for using index templates with the Python client.
The key sections of the guide include:
• Setup: Instructions for setting up a connection to an OpenSearch server running on the local machine.
• Index Template API Actions: Details on how to interact with the Index Template API to create and use index templates that match certain patterns. It demonstrates scenarios of using single and multiple templates, and how template priority affects the settings applied.
• Composable Index Templates: Information about the newer type of template, composable index templates, which allow for composing multiple component templates into a final one.
• Get an Index Template: Guidance on how to retrieve specifications of a particular index template.
• Delete an Index Template: Steps to delete a specified index template.
• Cleanup: Demonstrates how to delete created indices and templates for clean-up
Issues Resolved
Part of #351
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