I have just started using Elastic and Kibana as my company has opted for this tech stack to store much of our data. To analyse the data, I would prefer the use of Python, and hence have been trying to extract data with the Elasticsearch Python Client, but I can’t seem to do so. I suspect it is due to login credentials, but I have searched high and low for work-arounds but to no avail, would really appreciate any help I can get here! I keep running into this when I try to debug or try to look for the nodes connected:
This is how my Python code looks like but I am not sure where in the code I can include credentials as I have done so with the basic_auth argument (XXX is now my username and YYY is the password) but still get a ConnectionError (Timeout). Just in case this is the issue, how do I determine the host if it's a company shared portal? (ie. different users have access to the same data and visualisations)
es = Elasticsearch('https://company-host-name:9200',
basic_auth=("XXX", 'YYY'))
es.ping() # returns False
Welcome to the community! For future issues if you could share the error message as text that would be great as the image is a bit difficult to read.
I'm not sure which versions of Python and Elasticsearch you are using. But it looks to me from the error message that the the username you have specified in the basic_auth method doesn't have the required privileges for the operation you are trying to perform.
Are you able to configure the permissions required for that username in Stack Management to add the required permissions?
Thanks for your swift reply, I'll be sure to post the error message as text in future! I am using Python 3.10.9 and I am using Elasticsearch 8.8.0. I tried to go to Stack Management to add the permissions but I am unable to find the fields, please let me know how I can go about it!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.