Elasticsearch-py not compatible with cross cluster search

We have been using the elasticsearch-py module for a couple of years to automate data analysis across a multiple clusters using tribe nodes. We have now replaced the tribe nodes with cross cluster search nodes but seem unable to query the indexes using the cross cluster search syntax

Using es = Elasticsearch("cluster_name:index_name") or es = Elasticsearch("*:index_name") both fail with 404, 'index_not_found_exception', 'no such index' errors

is there a plan to make elasticsearch-py compatible with CCS in the near future ?


Thanks for raising this issue. Unfortunately CCS has flown under my radar as something that needed support in elasticsearch-py.

I've created a ticket in the Github Repo for this and will be working on it asap.


Sorry for the lateness of this.

But I just checked for Cross Cluster support and it appears to be working just fine.

The issue, after I re-read your question is the way you are instantiating the object.

first off you should create the Elasticsearch object with a host name not a cluster:indexcombo.

ie: es = Elasticsearch("cluster_name:index_name") is wrong

you want to do this:

es = Elasticsearch("hostname")

Then to do cross cluster search you would invoke a search like this:

es.search(index="cluster_name:index_name", body={"query": {"match_all": {}}})

THIS is assuming you've configured your two clusters properly to have cross cluster search setup.

Thanks Nick, I can confirm that it is working for me also now with the changes you suggested and can search across all clusters using a wildcard for cluster_name. I also tried elasticsearch_dsl and that worked fine also.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.