import boto3
from requests_aws4auth import AWS4Auth
from haystack.document_store.elasticsearch import ElasticsearchDocumentStore
from elasticsearch import RequestsHttpConnection
host = '<vpc_host>'
port = 443
region = 'eu-central-1'
service = 'es'
credentials = boto3.Session().get_credentials()
aws4auth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token)
document_store = OpenDistroElasticsearchDocumentStore(host=host,
port=port,
aws4auth=aws4auth,
# can't be used with default es client version used in e.g. aws sagemaker
embedding_field=None,
index="document")
你是说像this这样基于IAM的AWS访问吗?我们最近刚刚合并了一个功能,这可能会对您有所帮助(#965)。请从master branch安装最新的Haystack版本,并尝试以下方法:
相关问题 更多 >
编程相关推荐