 
 (defn deployment
   [deployment-id]
-  (when-let [document (:_source (esd/get @conn index-name deployment-type deployment-id :routing deployment-id))]
+  (when-let [document (:_source (esd/get @conn index-name deployment-type deployment-id))]
     (assoc document :id deployment-id)))
 
 (defn delete-deployment


(defn deployment-tasks
  [deployment-id]
  (nil-if-no-deployment deployment-id (->> (esd/search @conn index-name task-type :routing deployment-id :query (q/match-all) :filter (parent-filter deployment-type deployment-id) :sort {:sequence "asc"} :size 10000)
                                           esrsp/hits-from
                                           (map (fn [h] (assoc (:_source h) :id (:_id h))))
                                           (map #(dissoc % :sequence)))))

(defn deployment-logs
  [deployment-id since]
  (nil-if-no-deployment deployment-id (let [filters (add-since-date-filter [(parent-filter deployment-type deployment-id)] :date since)]
                                        (->> (esd/search @conn index-name log-type :query (q/match-all) :filter {:and {:filters filters}} :sort {:date "asc"} :size 10000)
                                             esrsp/hits-from
                                             (map (fn [h] (assoc (:_source h) :id (:_id h))))))))

