Created
November 1, 2020 06:22
-
-
Save tonkatsu7/de9e09501a26cc4d0877ff95c0be3025 to your computer and use it in GitHub Desktop.
Connect to elasticsearch 7 using basic authentication in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
host = 'SOME_GUID.southeastasia.azure.elastic-cloud.com' #without 'https' | |
basicAuth = ('USERNAME', 'PASSWORD') | |
es = elasticsearch.Elasticsearch( | |
hosts=[{'host': host, 'port': 9243}], | |
http_auth=basicAuth, | |
use_ssl=True, | |
verify_certs=True, | |
connection_class=elasticsearch.RequestsHttpConnection | |
) | |
print(es.info()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment