AttributeError:“Session”对象没有属性“merge\u environment\u settings”

2024-06-16 11:53:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个脚本,用来连接到AWS上的ElasticSearch集群来创建一些索引:

session = boto3.Session(region_name=os.environ['REGION'])
credentials = session.get_credentials()
awsauth = AWS4Auth(credentials.access_key,
                   credentials.secret_key,
                   session.region_name, 'es',
                   session_token=credentials.token)

es_client = Elasticsearch(
                endpoint_es,
                http_auth=awsauth,
                use_ssl=False,
                verify_certs=False,
                connection_class=RequestsHttpConnection)

# Create indexes for delete test
es_client.indices.create(index='sample-index')

运行此脚本时,出现以下错误:

^{pr2}$

以下是出现问题的文件(第72行): https://github.com/elastic/elasticsearch-py/blob/master/elasticsearch/connection/http_requests.py

为什么我不明白这个错误。有什么线索吗?在


Tags: keyname脚本clienttokenfalsehttpindex