Custom Search

Sunday, November 4, 2018

Python Elasticsearch API find cluster name

sudo pip install elasticsearch

from elasticsearch import Elasticsearch
HOST_URLS = ["http://127.0.0.1:9200"]
es_conn = Elasticsearch(HOST_URLS)

print "Cluster Name: ", es_conn.cluster.state(metric=["cluster_name"])['cluster_name']

No comments:

Post a Comment