I am using python client to connect to Elastic Cloud. I have tried connecting using basic_auth and api_keys. In both instances it gives me the following error
elasticsearch.AuthorizationException: AuthorizationException(403, "{'ok': False, 'message': 'Forbidden'}")
Here is the sample code:
<< from elasticsearch import Elasticsearch
es = Elasticsearch(cloud_id=<<>>, api_key=(api_key_id, api_key))
es = Elasticsearch(cloud_id=<<>>, basic_auth=(username, password)) >>
Can someone help me with this?
stephenb
(Stephen Brown)
April 26, 2023, 7:22pm
2
Hi @Venkatesh_Guruprasad
Perhaps take a look at this thread
I just did this
from elasticsearch import Elasticsearch
# you can use RFC-1738 to specify the url
# ... or specify common parameters as kwargs
es = Elasticsearch(
cloud_id="mycluster:sdfgsdfgdsfgdsfglvdsfgsdfgdsfgmNiM2JkNzRjNDY3JGIxZTUyOWEwNTBkNjRkODZhMzIxZTBhMjU3YjRlODhh",
http_auth=("elastic", "dsfgsdfgsdfgg"),
)
output = es.info(),
print(output, end=" ")
and it worked fine...
This also worked fine...
es = Elasticsearch(
cloud_id="mycluster:sdfgsdfgdsfgdsfgsdfgsdfgsdfgsdfg…
Perhaps you are using the wrong type of API Key as this user was
remember this is NOT and Elastic Cloud API key it is an Elasticsearch API key which can only be created via and API call see here
Actually API Keys can now be created via Kibana -> Stack Management -> API Keys as well now
system
(system)
Closed
May 24, 2023, 7:22pm
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.