 
 
 (defn ensure-index-and-mappings
+  "create index with name index-name and make sure the mappings in
+mapping-types are used. if the index already exists, just update the
+mappings"
   [index-name]
   (if (esi/exists? index-name)
     (doseq [[doctype mapping] mapping-types]

   entries))

(defn make-id-map
  [entries]
  (apply hash-map (mapcat (juxt :id identity) entries)))

(defn find-missing-entries
  [existing-map entries]
  (remove #(contains? existing-map (:id %)) entries))

(declare simplify-permissions-for-es)

     :mtime (-> fields :lastmodified lastmodified->mtime)}))

(defn enrich-es-entries
  "convert entries from es-listdir to our common format"
  [entries]
  (loop [entries entries]
    (if (map? entries)
