import elasticsearch # Connect to cluster at search1:9200, sniff all nodes and round-robin between them es = elasticsearch.Elasticsearch(["dataelasticsearch-a-master001:9200", "dataelasticsearch-b-master001:9200", "dataelasticsearch-e-master001:9200"], sniff_on_start=True) # Index a document: es.index( index="my_app", doc_type="blog_post", id=1, body={ "title": "Elasticsearch clients", "content": "Interesting content...", "date": "Thu Apr 10 16:26:10 PDT 2014", } ) # Get the document: es.get(index="my_app", doc_type="blog_post", id=1) # Search: es.search(index="my_app", body={"query": {"match": {"title": "elasticsearch"}}})