diff --git a/CHANGELOG.md b/CHANGELOG.md index 6962421..19abaf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ * bump math.combinatorics to 0.3.2 ### Fixed - +* ES conf can be created without a document type ## [0.7.32] - 2025-10-24 ### Changed diff --git a/src/clj/datasplash/es.clj b/src/clj/datasplash/es.clj index 883684c..48b3841 100644 --- a/src/clj/datasplash/es.clj +++ b/src/clj/datasplash/es.clj @@ -1,6 +1,7 @@ (ns datasplash.es (:require [charred.api :as charred] + [clojure.string :as str] [datasplash.core :as ds]) (:import (datasplash.fns ExtractKeyFn) @@ -19,13 +20,16 @@ {:username {:docstr "username"} :password {:docstr "password"} :keystore-password {:docstr "If Elasticsearch uses SSL/TLS with mutual authentication (via shield), provide the password to open the client keystore."} - :keystore-path {:docstr "If Elasticsearch uses SSL/TLS with mutual authentication (via shield), provide the password to open the client keystore."}})) + :keystore-path {:docstr "Path to a file to add to the keystore."}})) (defn- es-config "Creates a new Elasticsearch connection configuration." [hosts index type {:keys [username password keystore-password keystore-path]}] - (let [hosts-array (into-array String hosts)] - (cond-> (ElasticsearchIO$ConnectionConfiguration/create hosts-array index type) + (let [hosts-array (into-array String hosts) + conf (if (str/blank? type) + (ElasticsearchIO$ConnectionConfiguration/create hosts-array index) + (ElasticsearchIO$ConnectionConfiguration/create hosts-array index type))] + (cond-> conf username (.withUsername username) password (.withPassword password) keystore-password (.withKeystorePassword keystore-password) @@ -62,7 +66,7 @@ "Connects to ES, reads, and convert serialized json to clojure map." [hosts index type options] (let [safe-opts (dissoc options :name) - key-fn (or (get options :key-fn) false)] + key-fn (get options :key-fn false)] (ds/ptransform :read-es-to-clj [^PCollection pcoll]