1 Answer
- Newest
- Most votes
- Most comments
0
Hello,
I recommend double-checking the hard-coded OpenSearch endpoint. After reviewing the internal documentation, you can refer to the following document when using the Bulk API:
[+] Low-level Python client - Performing bulk operations
https://opensearch.org/docs/latest/clients/python-low-level/
Additionally, here is a sample test code I created using the above document. It worked correctly in my environment, so please refer to it.
import boto3
from requests_aws4auth import AWS4Auth
from opensearchpy import OpenSearch, RequestsHttpConnection, AWSV4SignerAuth
host = '<domain_endpoint>/_bulk'
region = 'ap-northeast-2'
service = 'es
credentials = boto3.Session().get_credentials()
awsauth = AWSV4SignerAuth(credentials, region, service)
client = OpenSearch(
# hosts=[{"host": host, "port": 9200}],
hosts=[host+"9200"],
http_auth=awsauth,
use_ssl=True,
verify_certs=True,
connection_class = RequestsHttpConnection,
pool_maxsize = 20
)
movies = '{ "index" : { "_index" : "<index>", "_id" : "2" } } \n { "title" : "Interstellar", "director" : "Christopher Nolan", "year" : "2014"} \n { "create" : { "_index" : "<index>", "_id" : "3" } } \n { "title" : "Star Trek Beyond", "director" : "Justin Lin", "year" : "2015"} \n { "update" : {"_id" : "3", "_index" : "<index>" } } \n { "doc" : {"year" : "2016"} }'
client.bulk(movies)
Relevant content
- asked 4 months ago
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
