方式1:
from elasticsearch import Elasticsearchconn = Elasticsearch( [{'host': host, 'port': ES_PORT, "http_auth": "%s:%s" % (ES_USER, ES_PASSWORD)} for host in ES_HOST])
方式2:
from elasticsearch import Elasticsearches = Elasticsearch(hosts=["http://user:password@IP:port/"])