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

Broken with ElasticSearch 2.0 #45

Open
bsima opened this issue Nov 14, 2015 · 8 comments
Open

Broken with ElasticSearch 2.0 #45

bsima opened this issue Nov 14, 2015 · 8 comments

Comments

@bsima
Copy link
Contributor

bsima commented Nov 14, 2015

It might be prudent to create 2 ElasticSearch components, one for 1.x and one for 2.x. Thoughts, @danielsz?

@danielsz
Copy link
Owner

Sure.

I'll be happy with a PR for a ElasticSearch 2.0 component.

@danielsz
Copy link
Owner

They can live in the same file, as far as I'm concerned.

@bsima
Copy link
Contributor Author

bsima commented Nov 14, 2015

Okay, I'll put one together today.

@bsima
Copy link
Contributor Author

bsima commented Nov 14, 2015

I've got an in-progress branch here, but when I try to build the client object I'm getting this error that I can't decipher. Any ideas?

system.components.elasticsearch2> (let [addresses   (InetSocketTransportAddress. (InetSocketAddress. "localhost" 9300))
                                        setting     (.. (Settings/settingsBuilder)
                                                        (put "cluster.name" "elasticsearch_bsima")
                                                        (build))
                                        client      (.. (TransportClient/builder)
                                                        (settings setting)
                                                        (build))]
                                    client)
NoSuchMethodError com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;  org.elasticsearch.threadpool.ThreadPool.<init> (ThreadPool.java:145)

               ThreadPool.java:  145  org.elasticsearch.threadpool.ThreadPool/<init>
          TransportClient.java:  119  org.elasticsearch.client.transport.TransportClient$Builder/build
                          REPL:    5  system.components.elasticsearch2/eval44909

Been banging my head against this error for a few hours now, and I'm not experienced in Java.

@danielsz
Copy link
Owner

My intuition is that more type hinting is needed. Maybe a ^java.util.concurrent.Executor somewhere in the chain.

@peterromfeldhk
Copy link

Hi, meanwhile there is elasticsearch 5 ;)
i had some help to get the client running (thanks to @seancorfield to figure out empty vector is needed):

(defn inet-addr [host port]
  (InetSocketTransportAddress. (InetSocketAddress. host port)))

(def client
  (-> (Settings/builder)
      (.put "cluster.name" "elasticsearch_pair")
      (.build)
      (PreBuiltTransportClient. [])
      (.addTransportAddress (inet-addr "localhost" 9300))
      (.addTransportAddress (inet-addr "localhost" 9301))))

maybe worth having elasticsearch5 and co, since im sure not to far away we will have 6 ;) ?

@peterromfeldhk
Copy link

not sure how it can live together with different deps

I made an example here following the same style you had already:
https://github.com/peterromfeldhk/clj-elastic/blob/master/src/clj_elastic/sys.clj

@danielsz
Copy link
Owner

Hi @peterromfeldhk

Thank you for looking into this.
Unless there is a specific reason, we don't retain components for older releases.
In other words, please feel free to submit a PR with the suggested changes in the component, and updated deps for Elasticsearch.

Thank you!

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

3 participants