             [io.cyanite.engine.buckets  :as b]
             [io.cyanite.index           :as index]
             [io.cyanite.store           :as store]
+            [io.cyanite.query           :as query]
             [qbits.jet.server           :refer [run-jetty]]
             [io.cyanite.utils           :refer [nbhm assoc-if-absent! now!]]
             [clojure.tools.logging      :refer [info debug error]]

  [{{:keys [query]} :params index :index}]
  (index/matches index (if (blank? query) "*" query) false))

(defmethod dispatch :metrics
  [{{:keys [from to path agg]} :params :keys [index store engine]}]
  (let [from  (or (parse-time from)

                           (if (sequential? path) path [path]))
                   (map (partial engine/resolution engine from))
                   (remove nil?))]
    (store/query! store index engine from to paths)))

(defmethod dispatch :default
  [_]
