The opensearch-py client includes a high level interface called opensearch-py-dsl that supports creating and indexing documents, searching with and without filters, and updating documents using queries. See opensearch-dsl-py client documentation for details and the API reference.
In the below example, Search API from opensearch-dsl-py client is used.
from opensearchpy import OpenSearch, Search
client = OpenSearch(...)
s = Search(
using=client,
index=index_name
)
.filter("term", category="search")
.query("match", title="python")
response = s.execute()
for hit in response:
print(hit.meta.score, hit.title)