Skip to content

Instantly share code, notes, and snippets.

@bryder
Last active May 22, 2017 21:28
Show Gist options
  • Save bryder/fa3a02c52268c323b7b5b7b99da08a53 to your computer and use it in GitHub Desktop.
Save bryder/fa3a02c52268c323b7b5b7b99da08a53 to your computer and use it in GitHub Desktop.
Shut up elastic debug logging if you change it globally and disable warnings about insecure ssl etc
logging.getLogger('elasticsearch.trace').setLevel(logging.WARNING)
logging.getLogger('elasticsearch').setLevel(logging.WARNING)
import urllib3
urllib3.disable_warnings() # Gets some of the warnings - but not the one from elasticsearch
with warnings.catch_warnings():
warnings.filterwarnings("ignore", ".*using SSL with verify_certs=False is insecure.*")
es = elasticsearch.Elasticsearch(url, retry_on_status=[503, 504, 401], **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment