-
-
Save Poogles/8811de2040994391ae897f7386253200 to your computer and use it in GitHub Desktop.
Spandex Bulk Index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns foo.index | |
(:require [qbits.spandex :as spandex]) | |
(:gen-class)) | |
;; You'll have to fix the types, away from my computer so I just wrote something in so you're sure what they do. | |
(defn generate-index-request | |
"Take an esindex path and a message and generate a index map." | |
^Map [^String esindex ^Map message ^String type] | |
(let [type (keyword type) | |
kwindex (keyword esindex)] | |
[{:index {:_index kwindex :_type type :_id nil}} ;; Nil ID is required for ES to genereate an ID. | |
message])) | |
;; Push the result of this onto the bulk channel they offer and it should work. | |
;; Shout if that's not enough. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks, I was playing around with the sync API and realized I had to run the edn through
spandex/chunks->body
first (which the bulk channel does for you)