Lifecycle management abstraction for ILM (Elasticsearch) and ISM (OpenSearch).
This module provides transformation between Elasticsearch's ILM (Index Lifecycle Management) and OpenSearch's ISM (Index State Management) policy formats, allowing the same policy API to work transparently with both engines.
Lifecycle management abstraction for ILM (Elasticsearch) and ISM (OpenSearch). This module provides transformation between Elasticsearch's ILM (Index Lifecycle Management) and OpenSearch's ISM (Index State Management) policy formats, allowing the same policy API to work transparently with both engines.
(create-policy! {:keys [uri version engine request-fn] :as conn}
policy-name
policy)Inputs: [{:keys [uri version engine request-fn], :as conn} :- ESConn policy-name :- s/Str policy :- Policy]
Create a lifecycle management policy.
The policy parameter should be in ILM format. It will be automatically transformed to ISM format if connecting to OpenSearch.
Inputs: [{:keys [uri version engine request-fn], :as conn} :- ESConn policy-name :- s/Str policy :- Policy]
Create a lifecycle management policy.
- For Elasticsearch: Creates an ILM policy
- For OpenSearch: Creates an ISM policy (automatically transforms ILM if needed)
The policy parameter should be in ILM format. It will be automatically
transformed to ISM format if connecting to OpenSearch.(delete-policy! {:keys [uri version engine request-fn] :as conn} policy-name)Inputs: [{:keys [uri version engine request-fn], :as conn} :- ESConn policy-name :- s/Str]
Delete a lifecycle management policy. Works with both Elasticsearch ILM and OpenSearch ISM.
Inputs: [{:keys [uri version engine request-fn], :as conn} :- ESConn policy-name :- s/Str]
Delete a lifecycle management policy.
Works with both Elasticsearch ILM and OpenSearch ISM.(get-policy {:keys [uri version engine request-fn] :as conn} policy-name)Inputs: [{:keys [uri version engine request-fn], :as conn} :- ESConn policy-name :- s/Str]
Get a lifecycle management policy. Works with both Elasticsearch ILM and OpenSearch ISM. Returns the policy in its native format (ILM or ISM).
Inputs: [{:keys [uri version engine request-fn], :as conn} :- ESConn policy-name :- s/Str]
Get a lifecycle management policy.
Works with both Elasticsearch ILM and OpenSearch ISM.
Returns the policy in its native format (ILM or ISM).Elasticsearch ILM policy structure
Elasticsearch ILM policy structure
OpenSearch ISM transition structure
OpenSearch ISM transition structure
(normalize-policy policy target-engine)Normalize a policy for the target engine. If the policy is already in the target format, return as-is. Otherwise, transform it.
Normalize a policy for the target engine. If the policy is already in the target format, return as-is. Otherwise, transform it.
(policy-uri uri policy-name)(policy-uri uri policy-name engine)Inputs: ([uri :- s/Str policy-name :- s/Str engine :- s/Keyword] [uri :- s/Str policy-name :- s/Str]) Returns: s/Str
Make a policy URI from a host, policy name, and engine type.
Inputs: ([uri :- s/Str policy-name :- s/Str engine :- s/Keyword] [uri :- s/Str policy-name :- s/Str]) Returns: s/Str Make a policy URI from a host, policy name, and engine type. - Elasticsearch uses _ilm/policy - OpenSearch uses _plugins/_ism/policies
(transform-ilm-to-ism ilm-policy)Inputs: [ilm-policy :- ILMPolicy] Returns: ISMPolicy
Transform Elasticsearch ILM policy to OpenSearch ISM policy.
ILM uses phases (hot, warm, cold, delete) with actions. ISM uses states with actions and transitions between states.
Example: (transform-ilm-to-ism {:phases {:hot {:actions {:rollover {:max_docs 100000}}} :delete {:min_age "30d" :actions {:delete {}}}}})
Inputs: [ilm-policy :- ILMPolicy]
Returns: ISMPolicy
Transform Elasticsearch ILM policy to OpenSearch ISM policy.
ILM uses phases (hot, warm, cold, delete) with actions.
ISM uses states with actions and transitions between states.
Example:
(transform-ilm-to-ism
{:phases {:hot {:actions {:rollover {:max_docs 100000}}}
:delete {:min_age "30d" :actions {:delete {}}}}})(transform-ism-to-ilm ism-policy)Inputs: [ism-policy :- ISMPolicy] Returns: ILMPolicy
Transform OpenSearch ISM policy to Elasticsearch ILM policy.
This is a best-effort transformation as ISM is more flexible than ILM. Some ISM features may not have direct ILM equivalents.
Inputs: [ism-policy :- ISMPolicy] Returns: ILMPolicy Transform OpenSearch ISM policy to Elasticsearch ILM policy. This is a best-effort transformation as ISM is more flexible than ILM. Some ISM features may not have direct ILM equivalents.
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 |