Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to connect to more than one cluster? #26

Open
gstamp opened this issue Sep 23, 2019 · 3 comments
Open

Is it possible to connect to more than one cluster? #26

gstamp opened this issue Sep 23, 2019 · 3 comments

Comments

@gstamp
Copy link

gstamp commented Sep 23, 2019

Is elastic capable of connecting to more than a single cluster? Based on the docs it seems like you can only specify connection details for a single cluster.

@radar
Copy link
Owner

radar commented Sep 23, 2019

I’ve never had to do it myself and so elastic doesn’t currently support it. A quick search turns up https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-cross-cluster-search.html so maybe it depends on how you query the HTTP endpoint.

Do you have an example of what this would look like over HTTP other than that? I ask as that’s elastic’s only way of communicating with ES servers currently.

@gstamp
Copy link
Author

gstamp commented Sep 23, 2019

In my case I'm not looking to search across two different clusters. Just to be able to make two independent connections and access those two clusters independently.

It's a slightly unusual use-case so I guess I'm not surprised it's not supported.

As an example it might be worth taking a quick look at elasticsearch-elixir which supports multiple connections by defining modules and associating config against those. Similar to how Ecto Repos are defined. Unfortunately elasticsearch-elixir's API is a little more intrusive that I'd prefer - I much prefer the simple approach taken by your library.

@radar
Copy link
Owner

radar commented Sep 23, 2019

Seems like it could be done relatively straightforward.

I would imagine configuration like:

config :elastic, clusters: %{
  primary: "primary.example.com",
  secondary: "secondary.example.com"
}

Then to query either cluster:

Elastic.Cluster.[function]

Where function there would be the functions from Elastic.HTTP. There would of course need to be changes done to Elastic.HTTP to support that.

Happy to accept patches for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants