Skip to content

Commit

Permalink
Merging opensearch-dsl-py to opensearch-py (#287)
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <[email protected]>
  • Loading branch information
saimedhi authored Feb 14, 2023
1 parent 9363639 commit c58375a
Show file tree
Hide file tree
Showing 98 changed files with 14,190 additions and 26 deletions.
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
*~
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added SigV4 support for Async Opensearch Client ([#254](https://github.com/opensearch-project/opensearch-py/pull/254))
- Compatibility with OpenSearch 2.1.0 - 2.4.1 ([#257](https://github.com/opensearch-project/opensearch-py/pull/257))
- Adding explicit parameters for AIOHttpConnection and AsyncTransport ([#276](https://github.com/opensearch-project/opensearch-py/pull/276))
- Merging opensearch-dsl-py into opensearch-py ([#287](https://github.com/opensearch-project/opensearch-py/pull/287))
### Changed
- Updated getting started to user guide ([#233](https://github.com/opensearch-project/opensearch-py/pull/233))
- Updated CA certificate handling to check OpenSSL environment variables before defaulting to certifi ([#196](https://github.com/opensearch-project/opensearch-py/pull/196))
Expand Down
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 High-level Python client](#using-high-level-python-client)
- [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 High-level Python client
High-level python client is now merged into Low-level python client. Thus, opensearch-py supports creating and indexing documents, searching with and without filters, and updating documents using queries.[High-level Python client documentation](https://opensearch.org/docs/latest/clients/python-high-level/).

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 from High-level Python 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 c58375a

Please sign in to comment.