import elasticsearch as ES
import elasticsearch.helpers as ESH
es = ES.Elasticsearch()
docs = [doc1, doc2, doc3]
n_success, n_fail = ESH.bulk(es, docs, index='test_index', doc_type=
    'test_doc', stats_only=True)
Elasticsearch bulk index in chunks using PyEs