   {:server      (or (System/getenv "ES_SERVER")      "192.168.0.100:9200")})
 
 ; curl -s 'http://localhost:9200/_template/*?pretty'
-; curl -XDELETE 'http://localhost:9200/_template/taxicab'
-; curl -XDELETE 'http://localhost:9200/taxicab-green-*'
+; curl -XDELETE 'http://localhost:9200/_template/taxicab' && curl -XDELETE 'http://localhost:9200/taxicab-green-*'
 (defn create-template [client template-name body]
   (let [url (str "_template/" template-name)]
     (if (= 404 (:status (s/request client {:url url :method :head})))

              (assoc  :dlon-km       (delta-km (:pickup-lon doc) (:dropoff-lon doc)))
              (assoc  :pickup-time   (to-time (:pickup-dt  doc)))
              (assoc  :dropoff-time  (to-time (:dropoff-dt doc)))
              (update :paid-ehail   #(or % 0.0))
              (#(assoc % :travel-h   (let [pickup-time  (:pickup-time  %)
                                           dropoff-time (:dropoff-time %)]
                                       (if (and dropoff-time pickup-time (not= dropoff-time pickup-time))
                                         (round (let[delta (- dropoff-time pickup-time)]
                                                  (if (pos? delta) delta (+ delta 24))))))))
             ;(update :pickup-time  to-int-str)
             ;(update :dropoff-time to-int-str)
              (#(assoc % :speed-kmph (if-let [travel-h (:travel-h %)] (if (> travel-h 0.17) (round (/ (:travel-km %) travel-h))))))
              (#(if (< (dist (:dlat-km %) (:dlon-km %)) 0.2) (reduce dissoc % [:dlat-km :dlon-km]) %))
              drop-fields)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(def es-types

   :travel-h     [:float    :travel-h]
   :speed-kmph   [:float    :speed-kmph]})

; Mapping CSV columns to lowercase to simplify schema definition
(def col-mapping (into {} (for [[k v] col-mapping-raw] [(if (string? k) (string/lower-case k) k) v])))

(def fields
  (->> (concat
         (for [weather-field (-> weather vals first keys)] [weather-field :float])
