错误:
<块引用>解析失败:http://[https://search--kibana-************ .eu-west-1..amazonaws.com/]:9200/example_index: InvalidURL
详情:
注意:URL 传递与 connect_es("https://kibana-endpoint.com") 一样正常。我的弹性搜索连接也成功了,但是在创建索引时我收到了这个错误。
def connect_es(endpoint):
# Handle aws auth for es
session = boto3.Session()
credentials = session.get_credentials()
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, session.region_name, 'es',
session_token=credentials.token)
print('Connecting to the ES Endpoint: {endpoint}'.format(endpoint=endpoint))
#try:
es_client = Elasticsearch(host=endpoint,
port=9200,
connection_class=RequestsHttpConnection,
timeout=60)
#print(es_client.hosts)
print('Connected to elasticsearch')
request_body = {
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
},
"mappings": {
"properties": {
"address": {
"index": "not_analyzed",
"type": "string"
},
"date_of_birth": {
"index": "not_analyzed",
"format": "dateOptionalTime",
"type": "date"
},
"some_PK": {
"index": "not_analyzed",
"type": "string"
},
"fave_colour": {
"index": "analyzed",
"type": "string"
},
"email_domain": {
"index": "not_analyzed",
"type": "string"
}
}
}}
print("creating 'example_index' index...")
es_client.indices.create(index = 'example_index', body = request_body)
mapping = es_client.indices.get_mapping(index="example_index")
如果有任何错误,请告诉我