fix async example (#330)
Signed-off-by: Jay Zarfoss <[email protected]>
This commit is contained in:
+3
-3
@@ -476,10 +476,10 @@ print(response)
|
|||||||
|
|
||||||
## Using IAM authentication with an async client
|
## 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
|
```python
|
||||||
from opensearchpy import OpenSearch, AsyncHttpConnection, AWSV4SignerAsyncAuth
|
from opensearchpy import AsyncOpenSearch, AsyncHttpConnection, AWSV4SignerAsyncAuth
|
||||||
import boto3
|
import boto3
|
||||||
|
|
||||||
host = '' # cluster endpoint, for example: my-test-domain.us-east-1.es.amazonaws.com
|
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)
|
auth = AWSV4SignerAsyncAuth(credentials, region, service)
|
||||||
index_name = 'python-test-index3'
|
index_name = 'python-test-index3'
|
||||||
|
|
||||||
client = OpenSearch(
|
client = AsyncOpenSearch(
|
||||||
hosts = [{'host': host, 'port': 443}],
|
hosts = [{'host': host, 'port': 443}],
|
||||||
http_auth = auth,
|
http_auth = auth,
|
||||||
use_ssl = True,
|
use_ssl = True,
|
||||||
|
|||||||
Reference in New Issue
Block a user