 
 (defn ->ESDatabase [target]
   (map->ElasticSearchDatabase (select-keys (merge target (:db target))
-                                           [:host :port :index :migration-index])))
+                                           [:host :port :index :migration-index :cluster :native-port])))
 
 ;; ============================================================================
 ;; Joplin interface

;; ============================================================================
;; Ragtime interface

(defrecord ElasticSearchDatabase [host port index migration-index]
  Migratable
  (add-migration-id [db id]
    (es-add-migration-id (client db) (get-migration-index db) id))

(defn client [{:keys [host port]}]
  (es/connect (str "http://" host ":" port)))

(defn native-client [{:keys [host port native-port cluster]}]
  (let [es-port (or native-port port)]
    (if cluster
      (esn/connect [[host es-port]] {"cluster.name" cluster})
      (esn/connect [[host es-port]]))))

(defn wait-for-ready [es-native-client shards]
  (-> es-native-client
