             [clojurewerkz.elastisch.rest.document :as esrd]
             [qbits.alia :as alia])
   (:gen-class))
+
+;;------------------------------------------------------------------------------
+;; Utils
+;;------------------------------------------------------------------------------
+
+(defn print-nitems
+  "Print number of items."
+  [data]
+  (let [nitems (count data)]
+    (println "Number of items:" nitems)
+    (when (<= nitems 20)
+      (println "Data:" data))))
 
 ;;------------------------------------------------------------------------------
 ;; Aggregation

                        :to   max-point
                        :step rollup
                        :series by-path})))]
    (newline)
    ndata))

;;------------------------------------------------------------------------------
;; Benchmark

  [data f name]
  (println (format "Flatting data with %s..." name))
  (let [fdata (time (doall (f data)))]
    (print-nitems fdata)
    (newline)
    fdata))

