I have 2 elasticsearch clusters (not nodes) I would like to access using the python official api.
I have changed Cluster lines in config files of each elasticsearch clusters:
cluster.name: elasticsearch_prod
cluster.name: elasticsearch_traf
But I can't find a way to connect to the second cluster, both are running (locally).
It seems possible to pass parameters to the Elasticsearch client constructor in python, http://www.elasticsearch.org/blog/unleash-the-clients-ruby-python-php-perl/
and the elasticsearch-python documentation eplains how to connect to a specific node or host, but not to a specific cluster: http://elasticsearch-py.readthedocs.org/en/master/api.html#elasticsearch
es = Elasticsearch(cluster='elasticsearch_traf')
leads to
In [86]: es.cluster.stats()
Out[86]: {u'cluster_name': u'elasticsearch_prod', [...]
I would like to have my clusters on different machines, and thus I prefer not to use different indexes.
Thanks
EDIT : I also tried connecting to nodes from wished cluster, but I can't make it work. My two running nodes have these names (auto :) )
'Jean Grey-Summers' (cluster_name: elasticsearch_prod)
'Sluk' (cluster_name: elasticsearch_traf)
But when I try:
es = Elasticsearch(['Jean Grey-Summers'],sniff_on_start=True)
or
es = Elasticsearch(['Sluk'], sniff_on_start=True)
It comes out with:
TransportError: TransportError(N/A, 'Enable to sniff hosts.')
The N/A makes me think I'm not doing it right...
As said in comments I'm not looking for tribe I think, I just want two clients to connect each to one different cluster running locally