   [template-name mapping-file]
   (esr/put (esr/index-template-url template-name)
            :body (file-as-json mapping-file)))
-
-
-
-
-

        (for [[k v] event
              :when v]
          (cond
           (.startsWith (name k) "_")
           [(.substring (name k) 1) (edn-safe-read v)]
           :else
           [k v]))))

(defn ^{:private true} elastic-event [event]
  (-> event
      massage-event
      stashify-timestamp))

(defn ^{:private true} riemann-to-elasticsearch [events]
  (->> [events]
       flatten
       (remove streams/expired?)
       (map elastic-event)))

(defn es-connect
  "Connects to the ElasticSearch node.  The optional argument is a url

            [clojurewerkz.elastisch.rest :as esr]
            [riemann.streams :as streams]))

(defn make-index-timestamper [index period]
  (let [formatter (clj-time.format/formatter (str "'" index "'"
                                  (cond
                                   (= period :day)
