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

  internal to Riemann.  Lastly, any fields starting with an `_` will
  have their value parsed as EDN.
"
  [doc-type & {:keys [index timestamping]
               :or {index "logstash"
                    timestamping :day}}]
  (let [index-namer (make-index-timestamper index timestamping)]
    (fn [events]
      (let [index (index-namer (clj-time.core/now))
            bulk-create-items (interleave (repeat {:create {:_type doc-type}})
                                          (riemann-to-elasticsearch events))]
        (when (seq bulk-create-items)
          (let [res (eb/bulk-with-index index bulk-create-items)]
            (info "elasticized" (count (:items res)) "items to index " index "in " (:took res) "ms")
            res))))))

(defn ^{:private true} resource-as-json [resource-name]
  (json/parse-string (slurp (io/resource resource-name))))

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

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

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

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