2

I’m using Elastisch, and the rest/connect function return an endpoint, but I can’t see how to reuse this endpoint when calling other functions. I need to transfer some documents from one index to another on different hosts, using a scroll on the first one and bulk indexing on the second one.

bfontaine
  • 18,169
  • 13
  • 73
  • 107

1 Answers1

2

elastisch also offers theconnect (without the !) that returns the connection to you instead of storing it in a local var. You can call this twice and then use binding to bind the appropriate one for each call.

(let [client1 (connect ...)
      client2 (connect ...)
      data (binding [clojurewerkz.elastisch.native/*client* client1] ...)
   (binding [clojurewerkz.elastisch.native/*client* client2] ... put stuff))
Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
  • Thanks! I’m using the REST api, so I changed from `clojurewerkz.elastisch.native/*client*` to `clojurewerkz.elastisch.rest/*endpoint*`. – bfontaine Aug 30 '13 at 09:27