   (println "This script will migrate resources from DB to Elastic Search")
   (let [resources ["usage" "usage-record"]]
     (run! migrate resources)
-    ;; TODO 
+    ;; TODO
     (clojure.pprint/pprint (esu/dump esb/client esb/index "usage"))
-    (clojure.pprint/pprint (esu/dump esb/client esb/index "usage-record"))))
+    (clojure.pprint/pprint (esu/dump esb/client esb/index "usage-record"))
+    ))
 
 
 

  (into {}
        (map (fn [[k v]] [k (s->edn v)]) (esu/json->edn json))))

(defn- migrate
  [resource]
  (println "Migrating " resource ", nb resources =" (select-count resource))
  (let [jsons (->> (kc/select resources
                              (kc/where {:id [like (str resource "/%")]})
                              ; TODO (kc/limit 2)
                              )
                   (map :data)
                   (map nested-json->edn)
                   (map acl/denormalize-acl)
                   (map fix-case-map)
                   (map esu/edn->json))]
    (bulk-store resource jsons)))

(defn -main
  "Main function to migrate resources from DB to Elastic Search"

    [com.sixsq.slipstream.ssclj.db.impl :as db]
    [com.sixsq.slipstream.ssclj.es.acl :as acl])
  (:gen-class))

;; Nb of documents stored per batch insert
(def batch-size 10)

(defn- id->uuid
  [id]
