Skip to content

Commit

Permalink
Update 2.x to be inline with main (#308)
Browse files Browse the repository at this point in the history
* Created untriaged issue workflow. (#290)

Signed-off-by: dblock <dblock@amazon.com>

* Removed 'out/opensearchpy' folder which was produced while generating pyi files for plugins (#288)

Signed-off-by: saimedhi <saimedhi@amazon.com>

* Merging opensearch-dsl-py to opensearch-py (#287)

Signed-off-by: saimedhi <saimedhi@amazon.com>

* Fixed CVE - issue 86 mentioned in opensearch-dsl-py repo (#295)

Signed-off-by: saimedhi <saimedhi@amazon.com>

* Removing low-level and high-level client terminology (#298)

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Added upgrading.md file and updated it for opensearch-py 2.2.0 release (#293)

Signed-off-by: saimedhi <saimedhi@amazon.com>

---------

Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: saimedhi <saimedhi@amazon.com>
Signed-off-by: Vacha Shah <vachshah@amazon.com>
Co-authored-by: Daniel (dB.) Doubrovkine <dblock@amazon.com>
Co-authored-by: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com>
Co-authored-by: Vacha Shah <vachshah@amazon.com>
  • Loading branch information
4 people authored Mar 1, 2023
1 parent 58aa041 commit e773f37
Show file tree
Hide file tree
Showing 110 changed files with 14,242 additions and 141 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/add-untriaged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Apply 'untriaged' label during issue lifecycle

on:
issues:
types: [opened, reopened, transferred]

jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['untriaged']
})
2 changes: 1 addition & 1 deletion .github/workflows/unified-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
stack_version: ['2.1.1']
stack_version: ['2.2.0']

steps:
- name: Checkout
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
__pycache__/
*.py[cod]
*$py.class
*.py[co]

# C extensions
*.so
Expand Down Expand Up @@ -51,6 +52,7 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
junit.xml

# Translations
*.mo
Expand Down Expand Up @@ -120,6 +122,7 @@ venv.bak/

# mkdocs documentation
/site
docs/_build

# mypy
.mypy_cache/
Expand All @@ -141,4 +144,8 @@ cython_debug/
# opensearch files
test_opensearch/cover
test_opensearch/local.py
.ci/output
.ci/output

#Vi text editor
.*.swp
*~
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [2.1.1]
### Added
- Merging opensearch-dsl-py into opensearch-py ([#287](https://github.com/opensearch-project/opensearch-py/pull/287))
- Added upgrading.md file and updated it for opensearch-py 2.2.0 release ([#293](https://github.com/opensearch-project/opensearch-py/pull/293))
### Changed
### Deprecated
### Removed
- Removed 'out/opensearchpy' folder which was produced while generating pyi files for plugins ([#288](https://github.com/opensearch-project/opensearch-py/pull/288))
### Fixed
- Fixed SigV4 Signing for Managed Service ([#279](https://github.com/opensearch-project/opensearch-py/pull/279))
- Fixed SigV4 Signing for Async Requests with QueryStrings ([#272](https://github.com/opensearch-project/opensearch-py/pull/279))
- Fixed CVE - issue 86 mentioned in opensearch-dsl-py repo ([#295](https://github.com/opensearch-project/opensearch-py/pull/295))
### Security

## [2.1.0]
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ OpenSearch Python Client
of elasticsearch-py licensed under the [Apache v2.0 License](https://github.com/opensearch-project/opensearch-py/blob/main/LICENSE.txt).
For more information, see [opensearch.org](https://opensearch.org/) and the [API Doc](https://opensearch-project.github.io/opensearch-py/).

This is the low-level client. A high-level Python client is in the works, and will be available soon.

## User Guide

To get started with the OpenSearch Python Client, see [User Guide](https://github.com/opensearch-project/opensearch-py/blob/main/USER_GUIDE.md).
Expand Down
24 changes: 24 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- [Upgrading OpenSearch Python Client](#upgrading-opensearch-python-client)
- [Upgrading to >= 2.2.0](#upgrading-to->=-2.2.0)
- [Features from High-Level Python Client](#features-from-high-level-python-client)
- [API Implementation differences for existing opensearch-dsl-py users](#api-implementation-differences-for-existing-opensearch-dsl-py-users)


# Upgrading OpenSearch Python Client

## Upgrading to >= 2.2.0

opensearch-py now includes [opensearch-dsl-py](https://pypi.org/project/opensearch-dsl/) features. opensearch-dsl-py was merged into opensearch-py preserving backwards compatibility with the previous opensearch-py version. (Refer [link](https://github.com/opensearch-project/opensearch-py/pull/287))


### Features from High-Level Python Client

opensearch-py functionalities that already exist are not altered.

The opensearchpy [helpers](https://github.com/opensearch-project/opensearch-py/tree/main/opensearchpy/helpers) module now provides access to aggs, analysis, document, faceted search, field, function, index, mapping, query, search, update by query, utils, and wrappers. As a result, without importing opensearch-dsl-py, these functionalities can be imported directly from opensearch-py.


### API Implementation differences for existing opensearch-dsl-py users

The functionalities from opensearch-dsl-py are merged into this client. Refer to the [USER_GUIDE](https://github.com/opensearch-project/opensearch-py/blob/main/USER_GUIDE.md#using-high-level-python-client) for an example on how to implement a feature from the previously known high level Python client.

35 changes: 34 additions & 1 deletion USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- [Deleting an index](#deleting-an-index)
- [Making API calls](#making-api-calls)
- [Point in time API](#point-in-time-api)
- [Using DSL features from opensearch-dsl-py](#using-dsl-features-from-opensearch-dsl-py)
- [Searching for documents with filters](#searching-for-documents-with-filters)
- [Using plugins](#using-plugins)
- [Alerting plugin](#alerting-plugin)
- [**Searching for monitors**](#searching-for-monitors)
Expand Down Expand Up @@ -228,6 +230,37 @@ print('\n The deleted point in time:')
print(response)
```

## Using DSL features from opensearch-dsl-py
opensearch-dsl-py client is now merged into the opensearch-py client. Thus, opensearch-py supports creating and indexing documents, searching with and without filters, and updating documents using queries. See [opensearch-dsl-py client documentation](https://opensearch.org/docs/latest/clients/python-high-level/) for details.

All the APIs newly added from opensearch-dsl-py are listed in [docs](https://github.com/opensearch-project/opensearch-py/tree/main/docs/source/api-ref).

In the below example, [Search API](https://github.com/opensearch-project/opensearch-py/blob/main/opensearchpy/helpers/search.py) from opensearch-dsl-py client is used.

### Searching for documents with filters

```python
from opensearchpy import OpenSearch, Search

# Use the above mentioned examples for creating client.
# Then,create an index
# Add a document to the index.

# Search for the document.
s = Search(using=client, index=index_name) \
.filter("term", category="search") \
.query("match", title="python")

response = s.execute()

print('\nSearch results:')
for hit in response:
print(hit.meta.score, hit.title)

# Delete the document.
# Delete the index.
```

## Using plugins

Plugin client definitions can be found here --
Expand Down Expand Up @@ -486,7 +519,7 @@ async def search():

search()
```
=======

### Using Kerberos

There are several python packages that provide Kerberos support over HTTP connections, such as [requests-kerberos](http://pypi.org/project/requests-kerberos) and [requests-gssapi](https://pypi.org/project/requests-gssapi). The following example shows how to setup the authentication. Note that some of the parameters, such as `mutual_authentication` might depend on the server settings.
Expand Down
4 changes: 4 additions & 0 deletions docs/source/api-ref/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
```{eval-rst}
.. autoclass:: opensearchpy.Urllib3HttpConnection
```

```{eval-rst}
.. autoclass:: opensearchpy.connections
```
16 changes: 16 additions & 0 deletions docs/source/api-ref/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,19 @@
```{eval-rst}
.. autoclass:: opensearchpy.TransportError
```

```{eval-rst}
.. autoclass:: opensearchpy.OpenSearchDslException
```

```{eval-rst}
.. autoclass:: opensearchpy.IllegalOperation
```

```{eval-rst}
.. autoclass:: opensearchpy.UnknownDslObject
```

```{eval-rst}
.. autoclass:: opensearchpy.ValidationException
```
23 changes: 23 additions & 0 deletions docs/source/api-ref/helpers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# helpers

```{toctree}
---
glob:
titlesonly:
maxdepth: 1
---
helpers/aggs
helpers/analysis
helpers/document
helpers/faceted_search
helpers/field
helpers/function
helpers/index
helpers/mapping
helpers/query
helpers/search
helpers/update_by_query
helpers/wrappers
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/aggs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# aggs

```{eval-rst}
.. autoclass:: opensearchpy.helpers.aggs.Agg
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/analysis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# analysis

```{eval-rst}
.. autoclass:: opensearchpy.helpers.analysis.Analyzer
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/document.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# document

```{eval-rst}
.. autoclass:: opensearchpy.helpers.document.Document
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/faceted_search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# faceted_search

```{eval-rst}
.. autoclass:: opensearchpy.helpers.faceted_search.FacetedSearch
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/field.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# field

```{eval-rst}
.. autoclass:: opensearchpy.helpers.field.Field
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/function.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# function

```{eval-rst}
.. autoclass:: opensearchpy.helpers.function.ScoreFunction
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# index

```{eval-rst}
.. autoclass:: opensearchpy.helpers.index.Index
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/mapping.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# mapping

```{eval-rst}
.. autoclass:: opensearchpy.helpers.mapping.Mapping
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/query.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# query

```{eval-rst}
.. autoclass:: opensearchpy.helpers.query.Query
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# search

```{eval-rst}
.. autoclass:: opensearchpy.helpers.search.Search
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/update_by_query.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# update_by_query

```{eval-rst}
.. autoclass:: opensearchpy.helpers.update_by_query.UpdateByQuery
```
5 changes: 5 additions & 0 deletions docs/source/api-ref/helpers/wrappers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# wrappers

```{eval-rst}
.. autoclass:: opensearchpy.helpers.wrappers.Range
```
4 changes: 4 additions & 0 deletions docs/source/api-ref/serializer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
```{eval-rst}
.. autoclass:: opensearchpy.JSONSerializer
```

```{eval-rst}
.. autoclass:: opensearchpy.AttrJSONSerializer
```
Loading

0 comments on commit e773f37

Please sign in to comment.