Engine detection and capability discovery for Elasticsearch and OpenSearch
Engine detection and capability discovery for Elasticsearch and OpenSearch
(detect-engine cluster-info)Inputs: [cluster-info] Returns: EngineInfo
Detect engine type and version from cluster info response.
Elasticsearch response example: {:name "node-1" :cluster_name "elasticsearch" :version {:number "7.17.0" :build_flavor "default" :build_type "docker"} :tagline "You Know, for Search"}
OpenSearch response example: {:name "node-1" :cluster_name "opensearch" :version {:distribution "opensearch" :number "2.19.0" :build_type "docker"} :tagline "The OpenSearch Project: https://opensearch.org/"}
Inputs: [cluster-info]
Returns: EngineInfo
Detect engine type and version from cluster info response.
Elasticsearch response example:
{:name "node-1"
:cluster_name "elasticsearch"
:version {:number "7.17.0"
:build_flavor "default"
:build_type "docker"}
:tagline "You Know, for Search"}
OpenSearch response example:
{:name "node-1"
:cluster_name "opensearch"
:version {:distribution "opensearch"
:number "2.19.0"
:build_type "docker"}
:tagline "The OpenSearch Project: https://opensearch.org/"}(get-cluster-info {:keys [uri request-fn] :as conn})Inputs: [{:keys [uri request-fn], :as conn} :- ESConn]
Fetch cluster info from root endpoint
Inputs: [{:keys [uri request-fn], :as conn} :- ESConn]
Fetch cluster info from root endpoint(parse-version version-str)Parse version string like '2.19.0' or '7.17.0' into components Returns {:major X :minor Y :patch Z}, or nil if parsing fails
Parse version string like '2.19.0' or '7.17.0' into components
Returns {:major X :minor Y :patch Z}, or nil if parsing fails(verify-connection conn)Inputs: [conn :- ESConn] Returns: EngineInfo
Verify connection and detect engine type and version.
Usage: (def conn (es-conn/connect {:host "localhost" :port 9200})) (verify-connection conn) ;; => {:engine :opensearch ;; :version {:major 2 :minor 19 :patch 0}}
This is useful for:
Inputs: [conn :- ESConn]
Returns: EngineInfo
Verify connection and detect engine type and version.
Usage:
(def conn (es-conn/connect {:host "localhost" :port 9200}))
(verify-connection conn)
;; => {:engine :opensearch
;; :version {:major 2 :minor 19 :patch 0}}
This is useful for:
1. Auto-detecting the engine type if not specified
2. Validating the connection configuration
3. Getting detailed version information(version-compare v1 v2)Inputs: [v1 :- VersionInfo v2 :- VersionInfo] Returns: s/Int
Compare two version maps. Returns:
Inputs: [v1 :- VersionInfo v2 :- VersionInfo] Returns: s/Int Compare two version maps. Returns: - negative if v1 < v2 - zero if v1 == v2 - positive if v1 > v2
(version<? v1 v2)Inputs: [v1 :- VersionInfo v2 :- VersionInfo] Returns: s/Bool
Check if version v1 < v2
Inputs: [v1 :- VersionInfo v2 :- VersionInfo] Returns: s/Bool Check if version v1 < v2
(version>=? v1 v2)Inputs: [v1 :- VersionInfo v2 :- VersionInfo] Returns: s/Bool
Check if version v1 >= v2
Inputs: [v1 :- VersionInfo v2 :- VersionInfo] Returns: s/Bool Check if version v1 >= v2
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |