fix async example (#330)

Signed-off-by: Jay Zarfoss <jzarfoss@farmersbusinessnetwork.com>
This commit is contained in:
jayzfbn
2023-03-20 13:30:48 -07:00
committed by GitHub
parent 2b9aee73a5
commit a495a20417
+3 -3
View File
@@ -476,10 +476,10 @@ print(response)
## Using IAM authentication with an async client
Make sure to use the `AsyncHttpConnection` connection class with the async `AWSV4SignerAsyncAuth` signer.
Make sure to use `AsyncOpenSearch` with the `AsyncHttpConnection` connection class with the async `AWSV4SignerAsyncAuth` signer.
```python
from opensearchpy import OpenSearch, AsyncHttpConnection, AWSV4SignerAsyncAuth
from opensearchpy import AsyncOpenSearch, AsyncHttpConnection, AWSV4SignerAsyncAuth
import boto3
host = '' # cluster endpoint, for example: my-test-domain.us-east-1.es.amazonaws.com
@@ -489,7 +489,7 @@ credentials = boto3.Session().get_credentials()
auth = AWSV4SignerAsyncAuth(credentials, region, service)
index_name = 'python-test-index3'
client = OpenSearch(
client = AsyncOpenSearch(
hosts = [{'host': host, 'port': 443}],
http_auth = auth,
use_ssl = True,