bloodhound-1.0.0.0: src/Database/Bloodhound/OpenSearch2/Client.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- |
-- Module : Database.Bloodhound.OpenSearch2.Client
-- Description : OpenSearch 2 client (re-exports Common + OpenSearch 2 plugins)
--
-- The OpenSearch 2 client. Re-exports the version-agnostic "Database.Bloodhound.Common.Client"
-- surface and adds OpenSearch 2 plugins: Index State Management (ISM), ML commons
-- models and agents, neural/kNN cache warmup and clearing, point in time (PIT),
-- asynchronous search, SQL and PPL, the notifications framework, and the
-- alerting/monitors framework.
module Database.Bloodhound.OpenSearch2.Client
( module Reexport,
pitSearch,
pitSearchWith,
openPointInTime,
openPointInTimeWith,
closePointInTime,
listAllPITs,
deleteAllPITs,
getMLTask,
deleteISMPolicy,
addISMPolicy,
putISMPolicy,
putISMPolicyWith,
removeISMPolicy,
changeISMPolicy,
retryISMIndex,
explainISMIndex,
explainISMIndexWith,
explainISMIndexFiltered,
getISMPolicy,
getISMPolicies,
postSMPolicy,
putSMPolicyWith,
getSMPolicy,
getSMPolicies,
deleteSMPolicy,
startSMPolicy,
stopSMPolicy,
explainSMPolicies,
getMLStats,
getModel,
registerModel,
registerModelWith,
deployModel,
undeployModel,
updateModel,
searchModels,
listModels,
deleteModel,
predict,
registerAgent,
getAgent,
deleteAgent,
searchAgents,
executeAgent,
warmupKnnIndex,
warmupKnnIndices,
clearKnnCache,
clearKnnCaches,
getKnnStats,
getKnnModel,
trainKnnModel,
trainKnnModelWith,
deleteKnnModel,
searchKnnModels,
submitOSAsyncSearch,
submitOSAsyncSearchWith,
getOSAsyncSearch,
deleteOSAsyncSearch,
getOSAsyncSearchStats,
sqlQuery,
sqlQueryNextPage,
closeSqlCursor,
explainSQL,
pplQuery,
explainPPL,
getSQLStats,
createNotificationConfig,
createNotificationConfigWith,
deleteNotificationConfig,
deleteNotificationConfigs,
getNotificationConfig,
getNotificationConfigs,
getNotificationConfigsWith,
getNotificationFeatures,
getNotificationChannels,
getNotificationChannelsWith,
updateNotificationConfig,
sendTestNotification,
createMonitor,
getMonitor,
updateMonitor,
updateMonitorWith,
deleteMonitor,
searchMonitors,
executeMonitor,
createSADetector,
getSADetector,
updateSADetector,
deleteSADetector,
searchSADetectors,
searchSAPrePackagedRules,
searchSACustomRules,
createSACustomRule,
updateSACustomRule,
deleteSACustomRule,
getSAMappingsView,
createSAMappings,
getSAMappings,
updateSAMappings,
getSAAlertsWith,
getSAAlerts,
acknowledgeSADetectorAlerts,
searchSAFindings,
createSACorrelationRule,
getSACorrelations,
findSACorrelation,
searchSACorrelationAlerts,
acknowledgeSACorrelationAlerts,
createSALogType,
searchSALogTypes,
updateSALogType,
deleteSALogType,
getDestinations,
getDestinationsWith,
createDestination,
updateDestination,
deleteDestination,
getAlertsWith,
getAlerts,
acknowledgeAlert,
getMonitorStats,
createEmailAccount,
getEmailAccount,
updateEmailAccount,
updateEmailAccountWith,
deleteEmailAccount,
createEmailGroup,
getEmailGroup,
updateEmailGroup,
updateEmailGroupWith,
deleteEmailGroup,
getDestination,
searchEmailAccounts,
searchEmailGroups,
searchFindings,
createComment,
updateComment,
searchComments,
deleteComment,
createDetector,
getDetector,
previewDetector,
previewDetectorInline,
startDetector,
stopDetector,
updateDetector,
updateDetectorWith,
deleteDetector,
validateDetector,
searchDetectors,
profileDetector,
getDetectorStats,
searchDetectorResults,
deleteDetectorResults,
searchDetectorTasks,
topAnomalies,
createRollup,
createRollupWith,
getRollup,
getAllRollups,
deleteRollup,
startRollup,
stopRollup,
explainRollup,
startReplication,
stopReplication,
pauseReplication,
resumeReplication,
updateReplicationSettings,
getReplicationStatus,
getReplicationStatusWith,
getLeaderStats,
getFollowerStats,
getAutoFollowStats,
createAutoFollowPattern,
deleteAutoFollowPattern,
createTransform,
updateTransform,
updateTransformWith,
getTransform,
getTransforms,
startTransform,
stopTransform,
explainTransform,
previewTransform,
deleteTransform,
)
where
import Control.Monad
import Data.Aeson
import Data.List.NonEmpty (NonEmpty)
import Data.Monoid
import Data.Text (Text)
import Data.Word (Word64)
import Database.Bloodhound.Client.Cluster
import Database.Bloodhound.Common.Client as Reexport hiding
( PreviewTransformResponse,
TransformId,
TransformStats,
deleteTransform,
explainTransform,
getTransforms,
previewTransform,
startTransform,
stopTransform,
unTransformId,
updateTransform,
updateTransformWith,
)
import Database.Bloodhound.Internal.Client.BHRequest
import Database.Bloodhound.OpenSearch2.Requests qualified as Requests
import Database.Bloodhound.OpenSearch2.Types
import Prelude hiding (filter, head)
-- | 'pitSearch' uses the point in time (PIT) API of OpenSearch, for a given
-- 'IndexName'. The supplied 'KeepAlive' duration is forwarded to every PIT
-- open\/extend call. Note that this will consume the entire search result set
-- and will be doing O(n) list appends so this may not be suitable for large
-- result sets. In that case, the point in time API should be used directly
-- with `openPointInTime` and `closePointInTime`.
--
-- This is a convenience wrapper around 'pitSearchWith' that lifts the
-- single 'IndexName' into an 'IndexPattern'. To search across multiple
-- comma-joined indices or a wildcard pattern, use 'pitSearchWith'
-- directly with an 'IndexPattern'.
--
-- Note that 'pitSearch' utilizes the 'search_after' parameter under the hood,
-- which requires a non-empty 'sortBody' field in the provided 'Search' value.
-- Otherwise, 'pitSearch' will fail to return all matching documents.
--
-- Closing the PIT (via 'closePointInTime') is best-effort cleanup: if it
-- fails, the accumulated hits are still returned rather than discarded. The
-- PIT will expire on its own once the @keep_alive@ elapses.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/api-reference/search-apis/point-in-time-api/>.
pitSearch ::
forall a m.
(FromJSON a, MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
KeepAlive ->
Search ->
m [Hit a]
pitSearch indexName = pitSearchWith (IndexPattern (unIndexName indexName))
-- | 'pitSearchWith' is the parameterized variant of 'pitSearch': it
-- takes an 'IndexPattern' as the target (@target_indexes@ on the wire),
-- which may be a single index name, a comma-separated list of indices,
-- or a wildcard pattern (e.g. @\"logs-*\"@, @\"logs-2024,logs-2025\"@).
-- Otherwise behaves exactly like 'pitSearch'. See
-- 'openPointInTimeWith' for the target rendering.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/api-reference/search-apis/point-in-time-api/>.
pitSearchWith ::
forall a m.
(FromJSON a, MonadBH m, WithBackend OpenSearch2 m) =>
IndexPattern ->
KeepAlive ->
Search ->
m [Hit a]
pitSearchWith indexPattern keepAlive search = do
openResp <- openPointInTimeWith indexPattern keepAlive defaultPITOptions
case openResp of
Left e -> throwEsError e
Right OpenPointInTimeResponse {..} -> do
let searchPIT = search {pointInTime = Just (PointInTime oos2PitId (Just keepAlive))}
hits <- pitAccumulator searchPIT []
closeResp <- closePointInTime (ClosePointInTime [oos2PitId])
case closeResp of
Left _ -> return hits
Right resp
| not (null (closePITs resp)) && all cpitSuccessful (closePITs resp) -> return hits
| otherwise -> error "failed to close point in time (PIT)"
where
pitAccumulator :: Search -> [Hit a] -> m [Hit a]
pitAccumulator search' oldHits = do
resp <- tryPerformBHRequest $ Requests.searchAll search'
case resp of
Left _ -> return []
Right searchResult -> case hits (searchHits searchResult) of
[] -> return oldHits
newHits -> case (hitSort $ last newHits, pitId searchResult) of
(Nothing, Nothing) ->
error "no point in time (PIT) ID or last sort value"
(Just _, Nothing) -> error "no point in time (PIT) ID"
(Nothing, _) -> return (oldHits <> newHits)
(Just lastSort, Just pitId') -> do
let newSearch =
search'
{ pointInTime = Just (PointInTime pitId' (Just keepAlive)),
searchAfterKey = Just lastSort
}
pitAccumulator newSearch (oldHits <> newHits)
-- | 'openPointInTime' opens a point in time for an index given an 'IndexName'
-- and a 'KeepAlive' duration (e.g. @keepAliveMinutes 1@). Note that the point
-- in time should be closed with 'closePointInTime' as soon as it is no longer
-- needed.
--
-- Equivalent to 'openPointInTimeWith' with
-- 'Database.Bloodhound.Internal.Versions.Common.Types.PointInTime.defaultPITOptions'
-- (no optional URI parameters).
--
-- For more information see
-- <https://docs.opensearch.org/2.18/api-reference/search-apis/point-in-time-api/>.
openPointInTime ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
KeepAlive ->
m (ParsedEsResponse OpenPointInTimeResponse)
openPointInTime indexName keepAlive = performBHRequest $ Requests.openPointInTime indexName keepAlive
-- | 'openPointInTimeWith' is the parameterized variant of
-- 'openPointInTime': it takes an 'IndexPattern' target (single name,
-- comma-list, or wildcard) and forwards the supplied 'PITOptions' as
-- query-string parameters in addition to the mandatory @keep_alive@.
-- See 'Database.Bloodhound.OpenSearch2.Requests.openPointInTimeWith'
-- for which parameters are emitted.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/api-reference/search-apis/point-in-time-api/#create-a-pit>.
openPointInTimeWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexPattern ->
KeepAlive ->
PITOptions ->
m (ParsedEsResponse OpenPointInTimeResponse)
openPointInTimeWith indexPattern keepAlive opts =
performBHRequest $ Requests.openPointInTimeWith indexPattern keepAlive opts
-- | 'closePointInTime' closes a point in time given a 'ClosePointInTime'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/api-reference/search-apis/point-in-time-api/>.
closePointInTime ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ClosePointInTime ->
m (ParsedEsResponse ClosePointInTimeResponse)
closePointInTime q = performBHRequest $ Requests.closePointInTime q
-- | 'listAllPITs' returns every currently-open point in time on the
-- cluster via @GET /_search/point_in_time/_all@. Each 'PITInfo' carries
-- the pit id, the @creation_time@ and the remaining @keep_alive@ (a bare
-- millisecond count on the wire); the @_shards@ summary is absent from
-- list entries (it appears only in the @POST@ create-PIT response, see
-- 'OpenPointInTimeResponse').
--
-- For more information see
-- <https://docs.opensearch.org/2.18/api-reference/search-apis/point-in-time-api/#list-all-pits>.
listAllPITs ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m [PITInfo]
listAllPITs = performBHRequest Requests.listAllPITs
-- | 'deleteAllPITs' deletes every currently-open point in time on the
-- cluster via @DELETE /_search/point_in_time/_all@ (no request body).
-- The server returns one 'ClosePointInTimeResult' per deleted PIT, so
-- the response reuses the 'ClosePointInTimeResponse' envelope; partial
-- failures are reported as failures. Deletes only local and mixed PITs,
-- not fully remote (cross-cluster) ones.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/api-reference/search-apis/point-in-time-api/#delete-pits>.
deleteAllPITs ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse ClosePointInTimeResponse)
deleteAllPITs = performBHRequest Requests.deleteAllPITs
-- | 'getMLTask' fetches the current state of an ML Commons asynchronous task
-- (model registration, deployment, training, ...). Poll this with the
-- @task_id@ returned by the submit endpoint until 'mlTaskInfoState' reaches
-- 'MLTaskStateCompleted' or 'MLTaskStateFailed'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/get-task/>.
getMLTask ::
(MonadBH m, WithBackend OpenSearch2 m) =>
MLTaskId ->
m (ParsedEsResponse MLTaskInfo)
getMLTask mlTaskId = performBHRequest $ Requests.getMLTask mlTaskId
-- | 'putISMPolicy' creates or updates an ISM policy.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#create-policy>
putISMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
PolicyId ->
ISMPolicyRequest ->
m (ParsedEsResponse PutISMPolicyResponse)
putISMPolicy policyId policy = performBHRequest $ Requests.putISMPolicy policyId policy
-- | 'putISMPolicyWith' creates or updates an ISM policy with an optional
-- optimistic-concurrency guard (@if_seq_no@ / @if_primary_term@). See
-- 'Requests.putISMPolicyWith' for semantics.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#create-policy>
putISMPolicyWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
PolicyId ->
ISMPolicyRequest ->
Maybe (Word64, Word64) ->
m (ParsedEsResponse PutISMPolicyResponse)
putISMPolicyWith policyId policy mOcc =
performBHRequest $ Requests.putISMPolicyWith policyId policy mOcc
-- | 'addISMPolicy' applies an existing ISM policy to an index.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#add-policy>
addISMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
PolicyId ->
IndexName ->
m (ParsedEsResponse ISMUpdatedIndicesResponse)
addISMPolicy policyId indexName = performBHRequest $ Requests.addISMPolicy policyId indexName
-- | 'removeISMPolicy' detaches any ISM policy from the given index.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#remove-policy>
removeISMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
m (ParsedEsResponse ISMUpdatedIndicesResponse)
removeISMPolicy indexName = performBHRequest $ Requests.removeISMPolicy indexName
-- | 'changeISMPolicy' updates the managed-index policy attached to an index.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#change-policy>
changeISMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
ChangePolicyRequest ->
m (ParsedEsResponse ISMUpdatedIndicesResponse)
changeISMPolicy indexName req = performBHRequest $ Requests.changeISMPolicy indexName req
-- | 'retryISMIndex' retries the failed ISM action for an index.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#retry-failed-index>
retryISMIndex ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
Maybe Text ->
m (ParsedEsResponse ISMUpdatedIndicesResponse)
retryISMIndex indexName mState = performBHRequest $ Requests.retryISMIndex indexName mState
-- | 'explainISMIndex' returns the ISM state of an index.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#explain-index>
explainISMIndex ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
m (ParsedEsResponse ISMExplanation)
explainISMIndex indexName = performBHRequest $ Requests.explainISMIndex indexName
-- | 'explainISMIndexWith' returns the ISM state of an index with optional
-- @show_policy@, @validate_action@, @local@ and @expand_wildcards@ query
-- parameters.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#explain-index>
explainISMIndexWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
ISMExplainOptions ->
m (ParsedEsResponse ISMExplanation)
explainISMIndexWith indexName opts =
performBHRequest $ Requests.explainISMIndexWith indexName opts
-- | 'explainISMIndexFiltered' returns the ISM state of an index via the
-- @POST /_plugins/_ism/explain/{index}@ "Explain index with filtering" form,
-- sending an 'ISMExplainFilter' as the request body.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#explain-index-with-filtering>
explainISMIndexFiltered ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
ISMExplainFilter ->
m (ParsedEsResponse ISMExplanation)
explainISMIndexFiltered indexName filt =
performBHRequest $ Requests.explainISMIndexFiltered indexName filt
-- | 'getISMPolicy' fetches a single policy by id.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#get-policy>
getISMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
PolicyId ->
m (ParsedEsResponse ISMPolicyInfo)
getISMPolicy policyId = performBHRequest $ Requests.getISMPolicy policyId
-- | 'getISMPolicies' lists policies, optionally filtered / paginated.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#get-policies>
getISMPolicies ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe ISMPoliciesQuery ->
m (ParsedEsResponse GetISMPoliciesResponse)
getISMPolicies mQuery = performBHRequest $ Requests.getISMPolicies mQuery
-- | 'deleteISMPolicy' deletes an ISM policy by id.
-- OpenSearch stores policies as documents in @.opendistro-ism-config@, so the
-- response is the standard document-delete envelope (parsed here as
-- 'IndexedDocument'), not an 'Acknowledged' ack.
-- See <https://docs.opensearch.org/2.18/im-plugin/ism/api/#delete-policy>
deleteISMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
PolicyId ->
m (ParsedEsResponse IndexedDocument)
deleteISMPolicy policyId = performBHRequest $ Requests.deleteISMPolicy policyId
-- =========================================================================
-- Snapshot Management plugin
-- =========================================================================
-- | 'postSMPolicy' creates a new SM policy.
postSMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SMPolicyName ->
SMPolicyBody ->
m (ParsedEsResponse SMPolicyResponse)
postSMPolicy policyName body = performBHRequest $ Requests.postSMPolicy policyName body
-- | 'putSMPolicyWith' updates an existing SM policy with the @if_seq_no@
-- / @if_primary_term@ optimistic-concurrency guard.
putSMPolicyWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SMPolicyName ->
SMPolicyBody ->
Word64 ->
Word64 ->
m (ParsedEsResponse SMPolicyResponse)
putSMPolicyWith policyName body seqNo primaryTerm =
performBHRequest $ Requests.putSMPolicyWith policyName body seqNo primaryTerm
-- | 'getSMPolicy' fetches a single SM policy by name.
getSMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SMPolicyName ->
m (ParsedEsResponse SMPolicyResponse)
getSMPolicy policyName = performBHRequest $ Requests.getSMPolicy policyName
-- | 'getSMPolicies' lists SM policies, optionally filtered / paginated.
getSMPolicies ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe GetSMPoliciesQuery ->
m (ParsedEsResponse GetSMPoliciesResponse)
getSMPolicies mQuery = performBHRequest $ Requests.getSMPolicies mQuery
-- | 'deleteSMPolicy' deletes an SM policy by name.
deleteSMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SMPolicyName ->
m (ParsedEsResponse DeleteSMPolicyResponse)
deleteSMPolicy policyName = performBHRequest $ Requests.deleteSMPolicy policyName
-- | 'startSMPolicy' enables an SM policy (sets @enabled=true@).
startSMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SMPolicyName ->
m (ParsedEsResponse Acknowledged)
startSMPolicy policyName = performBHRequest $ Requests.startSMPolicy policyName
-- | 'stopSMPolicy' disables an SM policy (sets @enabled=false@).
stopSMPolicy ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SMPolicyName ->
m (ParsedEsResponse Acknowledged)
stopSMPolicy policyName = performBHRequest $ Requests.stopSMPolicy policyName
-- | 'explainSMPolicies' returns the running state of policies matching a
-- name expression (comma list / wildcard).
explainSMPolicies ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m (ParsedEsResponse SMExplainResponse)
explainSMPolicies policyNames = performBHRequest $ Requests.explainSMPolicies policyNames
-- | 'getMLStats' fetches ML Commons plugin statistics. Both arguments are
-- optional: 'Nothing' for the node ID queries every node; 'Nothing' for the
-- stat name returns every stat. The endpoint is available whenever the ML
-- Commons plugin is installed (no cluster setting needs to be enabled).
--
-- For more information see
-- <https://docs.opensearch.org/2.18/ml-commons-plugin/api/stats/>.
getMLStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe MLNodeId ->
Maybe MLStatName ->
m (ParsedEsResponse MLStats)
getMLStats mNodeId mStatName = performBHRequest $ Requests.getMLStats mNodeId mStatName
-- | 'getModel' fetches full metadata for a registered model by its
-- 'ModelId'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/get-model/>.
getModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ModelId ->
m (ParsedEsResponse ModelInfo)
getModel modelId = performBHRequest $ Requests.getModel modelId
-- | 'registerModel' registers a model. Registration is asynchronous; poll
-- the returned @task_id@ via the Get ML Task API. Equivalent to
-- 'registerModelWith' with @deploy = False@.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/register-model/>
registerModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RegisterModelRequest ->
m (ParsedEsResponse MLTaskAck)
registerModel = performBHRequest . Requests.registerModel
-- | 'registerModelWith' registers a model with an optional @?deploy=true@
-- query flag that chains a deploy after successful registration.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/register-model/>
registerModelWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Bool ->
RegisterModelRequest ->
m (ParsedEsResponse MLTaskAck)
registerModelWith deploy req = performBHRequest $ Requests.registerModelWith deploy req
-- | 'deployModel' loads a registered model into memory on ML worker nodes.
-- Pass 'Nothing' to let OpenSearch pick eligible nodes; pass a
-- 'DeployModelRequest' to restrict to a node list. Deployment is
-- asynchronous; poll the returned @task_id@ via the Get ML Task API.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/deploy-model/>
deployModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ModelId ->
Maybe DeployModelRequest ->
m (ParsedEsResponse MLTaskAck)
deployModel modelId mReq = performBHRequest $ Requests.deployModel modelId mReq
-- | 'undeployModel' unloads a deployed model from ML worker nodes.
-- Synchronous; returns a node-keyed stats map.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/undeploy-model/>
undeployModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ModelId ->
m (ParsedEsResponse UndeployModelResponse)
undeployModel modelId = performBHRequest $ Requests.undeployModel modelId
-- | 'updateModel' updates a subset of a registered model's metadata.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/update-model/>
updateModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ModelId ->
UpdateModelRequest ->
m (ParsedEsResponse IndexedDocument)
updateModel modelId req = performBHRequest $ Requests.updateModel modelId req
-- | 'searchModels' searches the model index.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/search-model/>
searchModels ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Value ->
m (ParsedEsResponse ModelSearchResponse)
searchModels = performBHRequest . Requests.searchModels
-- | 'listModels' lists models. Historically this hit the
-- @POST /_plugins/_ml/models/_list@ endpoint, but OS 2.x removed POST
-- from @_list@ (it now returns 405). The modern, supported endpoint
-- for listing is @POST /_plugins/_ml/models/_search@ — the same one
-- 'searchModels' uses. Kept as a separate function rather than aliased
-- to 'searchModels' so callers and telemetry can distinguish the two
-- call sites.
listModels ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Value ->
m (ParsedEsResponse ModelSearchResponse)
listModels = performBHRequest . Requests.listModels
-- | 'deleteModel' deletes a registered model by id. OpenSearch stores
-- models as documents in @.plugins-ml-model@, so the response is the
-- standard document-delete envelope (parsed here as 'IndexedDocument'),
-- not an 'Acknowledged' ack — identical to 'deleteISMPolicy'. A
-- deployed model must be undeployed before it can be deleted, otherwise
-- the server returns an error which surfaces as an 'EsError'.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/model-apis/delete-model/>
deleteModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ModelId ->
m (ParsedEsResponse IndexedDocument)
deleteModel modelId = performBHRequest $ Requests.deleteModel modelId
-- | 'predict' invokes a deployed model. The request body and response are
-- model-specific, so both are opaque 'Value's.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/ml-commons-plugin/api/train-predict/predict/>.
predict ::
(MonadBH m, WithBackend OpenSearch2 m) =>
AlgorithmName ->
ModelId ->
Value ->
m (ParsedEsResponse Value)
predict algo modelId body = performBHRequest $ Requests.predict algo modelId body
-- | 'registerAgent' registers an ML Commons agent (OS 2.12+) — a named
-- configuration binding an LLM (or a routed population of sub-agents and
-- tools) behind a server-assigned 'AgentId'. Unlike 'registerModel',
-- registration is synchronous: the response carries the @agent_id@
-- directly, with no @task_id@ to poll.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/agent-apis/register-agent/>
registerAgent ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RegisterAgentRequest ->
m (ParsedEsResponse RegisterAgentResponse)
registerAgent = performBHRequest . Requests.registerAgent
-- | 'getAgent' fetches a registered agent by id. The body is the bare
-- stored agent document, decoded as 'AgentInfo'.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/agent-apis/get-agent/>
getAgent ::
(MonadBH m, WithBackend OpenSearch2 m) =>
AgentId ->
m (ParsedEsResponse AgentInfo)
getAgent agentId = performBHRequest $ Requests.getAgent agentId
-- | 'deleteAgent' deletes a registered agent by id. The response is
-- the standard document-delete envelope ('IndexedDocument').
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/agent-apis/delete-agent/>
deleteAgent ::
(MonadBH m, WithBackend OpenSearch2 m) =>
AgentId ->
m (ParsedEsResponse IndexedDocument)
deleteAgent agentId = performBHRequest $ Requests.deleteAgent agentId
-- | 'searchAgents' searches the agent index via
-- @POST /_plugins/_ml/agents/_search@.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/agent-apis/search-agent/>
searchAgents ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Value ->
m (ParsedEsResponse AgentSearchResponse)
searchAgents = performBHRequest . Requests.searchAgents
-- | 'executeAgent' runs a registered agent synchronously, returning
-- its 'ExecuteAgentResponse'.
-- See <https://docs.opensearch.org/2.18/ml-commons-plugin/api/agent-apis/execute-agent/>
executeAgent ::
(MonadBH m, WithBackend OpenSearch2 m) =>
AgentId ->
ExecuteAgentRequest ->
m (ParsedEsResponse ExecuteAgentResponse)
executeAgent agentId = performBHRequest . Requests.executeAgent agentId
-- | 'warmupKnnIndices' loads the k-NN native library indices for the given
-- indices into memory on the data nodes, so the first k-NN search against
-- each index does not pay the native-engine load latency. Maps to
-- @GET /_plugins/_knn/warmup/{index}@ (the index segment is rendered as a
-- comma-separated list, matching the OpenSearch multi-target syntax) and
-- returns 'ShardsResult' (the @{\"_shards\":{...}}@ envelope,
-- live-verified against OS 2.19.5 and 3.7.0) on success. The warmup is
-- asynchronous — the response is returned as soon as the load is
-- scheduled.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/vector-search/api/knn/#warmup-operation>.
warmupKnnIndices ::
(MonadBH m, WithBackend OpenSearch2 m) =>
[IndexName] ->
m ShardsResult
warmupKnnIndices indexNames = performBHRequest $ Requests.warmupKnnIndex indexNames
-- | 'warmupKnnIndex' is a convenience wrapper around 'warmupKnnIndices'
-- for the common single-index case. See 'warmupKnnIndices' for the
-- multi-index variant.
warmupKnnIndex ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
m ShardsResult
warmupKnnIndex indexName = warmupKnnIndices [indexName]
-- | 'clearKnnCaches' drops the native cache entries that the k-NN plugin
-- maintains for the given indices (the @faiss@ \/ @nmslib@ native library
-- index handles), freeing the associated native-memory reservations. Has
-- no effect on @lucene@ indexes. Maps to
-- @POST /_plugins/_knn/clear_cache/{index}@ (the index segment is rendered
-- as a comma-separated list, matching the OpenSearch multi-target syntax;
-- available since OpenSearch 2.14) and returns 'ShardsResult' (the
-- @{\"_shards\":{...}}@ envelope, live-verified against OS 2.19.5 and
-- 3.7.0) on success.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/vector-search/api/knn/#k-nn-clear-cache>.
clearKnnCaches ::
(MonadBH m, WithBackend OpenSearch2 m) =>
[IndexName] ->
m ShardsResult
clearKnnCaches indexNames = performBHRequest $ Requests.clearKnnCache indexNames
-- | 'clearKnnCache' is a convenience wrapper around 'clearKnnCaches' for
-- the common single-index case. See 'clearKnnCaches' for the multi-index
-- variant.
clearKnnCache ::
(MonadBH m, WithBackend OpenSearch2 m) =>
IndexName ->
m ShardsResult
clearKnnCache indexName = clearKnnCaches [indexName]
-- | 'getKnnStats' fetches k-NN plugin statistics. Both arguments are
-- optional: 'Nothing' for the node ID queries every node; 'Nothing' for the
-- stat name returns every stat. The response is a flat 'KnnStats' envelope
-- (cluster-level scalars plus a @nodes@ per-node map); navigate it via
-- 'knnStatsEntries'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/vector-search/api/knn/#stats>.
getKnnStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe KnnNodeId ->
Maybe KnnStatName ->
m (ParsedEsResponse KnnStats)
getKnnStats mNodeId mStatName = performBHRequest $ Requests.getKnnStats mNodeId mStatName
-- | 'getKnnModel' fetches metadata for a trained k-NN model by its
-- 'ModelId'. Maps to @GET /_plugins/_knn/models/{model_id}@. The response is
-- a bare object (no envelope), decoded into 'KnnModel'; the
-- 'knnModelModelBlob' field is large and may be absent when the caller has
-- excluded it via @?filter_path@.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/vector-search/api/knn/#get-a-model>.
getKnnModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ModelId ->
m (ParsedEsResponse KnnModel)
getKnnModel modelId = performBHRequest $ Requests.getKnnModel modelId
-- | 'trainKnnModel' schedules asynchronous training of a k-NN native library
-- model (e.g. FAISS IVF) from the vectors in a training index's
-- @knn_vector@ field. Maps to @POST /_plugins/_knn/models/{model_id}/_train@.
-- The request returns as soon as training is scheduled; the
-- 'KnnTrainResponse' echoes the @model_id@ under which training was
-- scheduled. To observe progress, poll 'getKnnModel' and watch
-- 'knnModelState' transition from @training@ to @created@ (success) or
-- @failed@ (consult 'knnModelError' for the cause).
--
-- Equivalent to 'trainKnnModelWith' with @Nothing@ (no node preference).
--
-- For more information see
-- <https://docs.opensearch.org/2.18/vector-search/api/knn/#train-a-model>.
trainKnnModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ModelId ->
KnnTrainingRequest ->
m (ParsedEsResponse KnnTrainResponse)
trainKnnModel = trainKnnModelWith Nothing
-- | 'trainKnnModelWith' extends 'trainKnnModel' with an optional
-- @?preference@ query parameter. Supplying 'Just' a 'KnnNodeId' pins the
-- asynchronous training task to the specified data node, sent on the wire
-- as @?preference={node_id}@; 'Nothing' lets OpenSearch choose the training
-- node. The pinned node must already host a shard of the training index,
-- otherwise OpenSearch rejects the request.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/vector-search/api/knn/#train-a-model>.
trainKnnModelWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe KnnNodeId ->
ModelId ->
KnnTrainingRequest ->
m (ParsedEsResponse KnnTrainResponse)
trainKnnModelWith mNodeId modelId req =
performBHRequest $ Requests.trainKnnModelWith mNodeId modelId req
-- | 'deleteKnnModel' removes a trained k-NN model by its 'ModelId'.
-- Maps to @DELETE /_plugins/_knn/models/{model_id}@ and returns a
-- 'KnnDeleteModelResponse' echoing the @model_id@ and reporting
-- @result = "deleted"@. Note this is NOT the standard 'Acknowledged'
-- envelope (the k-NN plugin returns a richer response than the typical
-- cluster-level ack). A missing model id surfaces as an 'EsError' via
-- 'StatusDependant', matching 'getKnnModel' and the ML Commons
-- 'deleteModel' precedent.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/vector-search/api/knn/#delete-a-model>.
deleteKnnModel ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ModelId ->
m (ParsedEsResponse KnnDeleteModelResponse)
deleteKnnModel modelId = performBHRequest $ Requests.deleteKnnModel modelId
-- | 'searchKnnModels' searches the @.opensearch-knn-models@ system index
-- via @POST /_plugins/_knn/models/_search@. The caller drives the query
-- through the standard 'Search' DSL (paginate with @from@\/@size@, filter
-- with 'queryBody', and exclude the large 'knnModelModelBlob' via the
-- 'source' projection). Returns the standard search envelope as a
-- 'SearchResult' whose hits carry a 'KnnModel' in each @_source@.
--
-- Mirrors 'knnSearch' in shape; see
-- 'Database.Bloodhound.OpenSearch2.Requests.searchKnnModels' for the
-- request-level details.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/vector-search/api/knn/#search-for-a-model>.
searchKnnModels ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Search ->
m (SearchResult KnnModel)
searchKnnModels search = performBHRequest $ Requests.searchKnnModels search
-- | 'submitOSAsyncSearch' submits a 'Search' for asynchronous execution via
-- the OpenSearch async search plugin (@POST /_plugins/_asynchronous_search@),
-- returning immediately with an id and partial results. This is the
-- OpenSearch-plugin-path analogue of the Elasticsearch 'submitAsyncSearch';
-- poll the returned id with 'getOSAsyncSearch' until 'asyncSearchIsRunning'
-- is @False@.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/search-plugins/async/index/#submit>.
submitOSAsyncSearch ::
(FromJSON a, MonadBH m, WithBackend OpenSearch2 m) =>
Search ->
m (AsyncSearchResult a)
submitOSAsyncSearch = performBHRequest . Requests.submitOSAsyncSearch
-- | Like 'submitOSAsyncSearch' but accepts 'AsyncSearchSubmitOptions'
-- carrying the URI parameters documented for
-- @POST /_plugins/_asynchronous_search@ (@wait_for_completion@,
-- @keep_on_completion@, @keep_alive@). The Elasticsearch-only
-- 'assoBatchedReduceSize' and 'assoCcsMinimizeRoundtrips' are silently
-- dropped. 'defaultAsyncSearchSubmitOptions' makes this byte-for-byte
-- equivalent to 'submitOSAsyncSearch'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/search-plugins/async/index/#submit>.
submitOSAsyncSearchWith ::
(FromJSON a, MonadBH m, WithBackend OpenSearch2 m) =>
AsyncSearchSubmitOptions ->
Search ->
m (AsyncSearchResult a)
submitOSAsyncSearchWith opts = performBHRequest . Requests.submitOSAsyncSearchWith opts
-- | 'getOSAsyncSearch' polls an OpenSearch async search by id, returning its
-- current state and (partial or final) results. Maps to
-- @GET /_plugins/_asynchronous_search/{id}@.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/search-plugins/async/index/#get>.
getOSAsyncSearch ::
(FromJSON a, MonadBH m, WithBackend OpenSearch2 m) =>
AsyncSearchId ->
m (AsyncSearchResult a)
getOSAsyncSearch = performBHRequest . Requests.getOSAsyncSearch
-- | 'deleteOSAsyncSearch' deletes an OpenSearch async search result and its
-- context by id. Maps to @DELETE /_plugins/_asynchronous_search/{id}@ and returns
-- 'Acknowledged' on success.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/search-plugins/async/index/#delete>.
deleteOSAsyncSearch ::
(MonadBH m, WithBackend OpenSearch2 m) =>
AsyncSearchId ->
m Acknowledged
deleteOSAsyncSearch = performBHRequest . Requests.deleteOSAsyncSearch
-- | 'getOSAsyncSearchStats' fetches cluster-wide async-search statistics.
-- See 'Database.Bloodhound.OpenSearch2.Requests.getOSAsyncSearchStats'.
getOSAsyncSearchStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m AsyncSearchStatsResponse
getOSAsyncSearchStats = performBHRequest Requests.getOSAsyncSearchStats
-- | 'sqlQuery' executes a SQL query via the OpenSearch SQL plugin
-- (@POST /_plugins/_sql@). Returns a JDBC-style rowset ('SQLResult'). Use
-- 'sqlRequestFetchSize' to opt into cursor pagination, then walk subsequent
-- pages with 'sqlQueryNextPage' and release an unfinished cursor with
-- 'closeSqlCursor'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/sql-and-ppl/sql-and-ppl-api/index/>.
sqlQuery ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SQLRequest ->
m (ParsedEsResponse SQLResult)
sqlQuery = performBHRequest . Requests.sqlQuery
-- | 'sqlQueryNextPage' fetches the next page of a paginated SQL result by
-- POSTing the opaque 'SQLCursor' returned by a previous 'sqlQuery' or
-- 'sqlQueryNextPage' call. The server drops @schema@, @total@, @size@ and
-- @status@ from continuation responses, so every 'SQLResult' field except
-- 'sqlResultDatarows' is 'Maybe'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/sql-and-ppl/sql-and-ppl-api/index/#cursor-and-paginating-results>.
sqlQueryNextPage ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SQLCursor ->
m (ParsedEsResponse SQLResult)
sqlQueryNextPage = performBHRequest . Requests.sqlQueryNextPage
-- | 'closeSqlCursor' releases the server-side context held by a SQL
-- pagination cursor (@POST /_plugins/_sql/close@). Call this when you stop
-- reading before the cursor is naturally exhausted.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/sql-and-ppl/sql-and-ppl-api/index/#cursor-and-paginating-results>.
closeSqlCursor ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SQLCursor ->
m (ParsedEsResponse SQLCloseResult)
closeSqlCursor = performBHRequest . Requests.closeSqlCursor
-- | 'explainSQL' translates a SQL query into the underlying query DSL without
-- executing it (@POST /_plugins/_sql/_explain@). The response shape varies by
-- query and plugin version, so it is returned as an opaque 'Value'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/sql-and-ppl/sql-and-ppl-api/index/#explain-api>.
explainSQL ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SQLRequest ->
m (ParsedEsResponse Value)
explainSQL = performBHRequest . Requests.explainSQL
-- | 'pplQuery' executes a PPL (Piped Processing Language) query via the
-- OpenSearch SQL plugin's PPL endpoint (@POST /_plugins/_ppl@). Returns the
-- same JDBC-style rowset shape as 'sqlQuery' (typed as 'PPLResult'). PPL
-- does not support cursor pagination.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/sql-and-ppl/sql-and-ppl-api/index/>.
pplQuery ::
(MonadBH m, WithBackend OpenSearch2 m) =>
PPLRequest ->
m (ParsedEsResponse PPLResult)
pplQuery = performBHRequest . Requests.pplQuery
-- | 'explainPPL' translates a PPL query into the underlying query DSL without
-- executing it (@POST /_plugins/_ppl/_explain@). The response shape varies by
-- query and plugin version, so it is returned as an opaque 'Value'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/sql-and-ppl/sql-and-ppl-api/index/#explain-api>.
explainPPL ::
(MonadBH m, WithBackend OpenSearch2 m) =>
PPLRequest ->
m (ParsedEsResponse Value)
explainPPL = performBHRequest . Requests.explainPPL
-- | 'getSQLStats' fetches SQL plugin statistics
-- (@GET /_plugins/_sql/stats@). The endpoint is node-level only (the
-- plugin documents that cluster-level stats are not implemented), so the
-- response describes only the node you hit; there is no @nodes@ sub-key
-- to navigate. The body is decoded as a flat 'SQLPluginStats' map keyed
-- by metric name because the metric-name set grows across OpenSearch
-- releases.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/sql-and-ppl/sql-and-ppl-api/index/>.
getSQLStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse SQLPluginStats)
getSQLStats = performBHRequest Requests.getSQLStats
-- =========================================================================
-- Notifications plugin
-- =========================================================================
-- | 'createNotificationConfig' creates a notification channel
-- configuration via the Notifications plugin
-- (@POST /_plugins/_notifications/configs@). The server assigns the
-- @config_id@ and echoes it in the 'CreateNotificationConfigResponse'.
-- Equivalent to 'createNotificationConfigWith' with 'Nothing'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/observing-your-data/notifications/api/#create-notification-config>.
createNotificationConfig ::
(MonadBH m, WithBackend OpenSearch2 m) =>
NotificationConfig ->
m (ParsedEsResponse CreateNotificationConfigResponse)
createNotificationConfig = performBHRequest . Requests.createNotificationConfig
-- | 'createNotificationConfigWith' is the parameterized variant of
-- 'createNotificationConfig': the optional 'Text' is forwarded as the
-- request's @config_id@. Pass 'Nothing' for a server-assigned id; pass
-- @'Just' id@ for a stable identifier (a duplicate surfaces as HTTP
-- 409, decoded as an 'EsError' via 'StatusDependant').
-- See <https://docs.opensearch.org/2.18/observing-your-data/notifications/api/#create-notification-config>.
createNotificationConfigWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Text ->
NotificationConfig ->
m (ParsedEsResponse CreateNotificationConfigResponse)
createNotificationConfigWith mConfigId config =
performBHRequest $ Requests.createNotificationConfigWith mConfigId config
-- | 'deleteNotificationConfig' removes a notification channel
-- configuration by @config_id@ via the Notifications plugin
-- (@DELETE /_plugins/_notifications/configs/{config_id}@). The result
-- is a 'DeleteNotificationConfigResponse' mapping the id to its
-- per-id deletion status; use 'deleteResponseAllOK' for a quick
-- success check or 'deleteResponseStatus' for the raw status string.
-- A 404 (unknown @config_id@) surfaces as 'Left' 'EsError'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/observing-your-data/notifications/api/#delete-channel-configuration>.
deleteNotificationConfig ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m (ParsedEsResponse DeleteNotificationConfigResponse)
deleteNotificationConfig =
performBHRequest . Requests.deleteNotificationConfig
-- | 'getNotificationConfigs' lists every notification channel
-- configuration (@GET /_plugins/_notifications/configs@), returning
-- each as a 'NotificationConfigEntry'. Equivalent to
-- 'getNotificationConfigsWith' with 'defaultNotificationListOptions'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/observing-your-data/notifications/api/#get-notification-config>.
getNotificationConfigs ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse [NotificationConfigEntry])
getNotificationConfigs = performBHRequest Requests.getNotificationConfigs
-- | 'getNotificationConfigsWith' is the parameterized variant of
-- 'getNotificationConfigs': the supplied 'NotificationListOptions' are
-- forwarded as query-string parameters. Pass
-- 'defaultNotificationListOptions' for the plain no-arg GET.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/observing-your-data/notifications/api/#get-notification-config>.
getNotificationConfigsWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
NotificationListOptions ->
m (ParsedEsResponse [NotificationConfigEntry])
getNotificationConfigsWith opts =
performBHRequest $ Requests.getNotificationConfigsWith opts
-- | 'getNotificationChannels' lists every notification channel
-- (@GET /_plugins/_notifications/channels@) as a lightweight 'Channel'
-- summary view (no transport details). Equivalent to
-- 'getNotificationChannelsWith' with 'defaultNotificationListOptions'.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/observing-your-data/notifications/api/#list-all-notification-channels>.
getNotificationChannels ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse [Channel])
getNotificationChannels = performBHRequest Requests.getNotificationChannels
-- | 'getNotificationChannelsWith' is the parameterized variant of
-- 'getNotificationChannels': the supplied 'NotificationListOptions' are
-- forwarded as query-string parameters. Pass
-- 'defaultNotificationListOptions' for the plain no-arg GET.
--
-- For more information see
-- <https://docs.opensearch.org/2.18/observing-your-data/notifications/api/#list-all-notification-channels>.
getNotificationChannelsWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
NotificationListOptions ->
m (ParsedEsResponse [Channel])
getNotificationChannelsWith opts =
performBHRequest $ Requests.getNotificationChannelsWith opts
-- | 'getNotificationConfig' fetches a single notification channel
-- configuration by id. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getNotificationConfig'.
getNotificationConfig ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m (ParsedEsResponse (Maybe NotificationConfigEntry))
getNotificationConfig = performBHRequest . Requests.getNotificationConfig
-- | 'updateNotificationConfig' replaces a notification channel
-- configuration by id. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateNotificationConfig'.
updateNotificationConfig ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
NotificationConfig ->
m (ParsedEsResponse CreateNotificationConfigResponse)
updateNotificationConfig configId config =
performBHRequest $ Requests.updateNotificationConfig configId config
-- | 'deleteNotificationConfigs' is the batch variant of
-- 'deleteNotificationConfig'. See
-- 'Database.Bloodhound.OpenSearch2.Requests.deleteNotificationConfigs'.
deleteNotificationConfigs ::
(MonadBH m, WithBackend OpenSearch2 m) =>
NonEmpty Text ->
m (ParsedEsResponse DeleteNotificationConfigResponse)
deleteNotificationConfigs =
performBHRequest . Requests.deleteNotificationConfigs
-- | 'getNotificationFeatures' lists supported channel configuration
-- types. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getNotificationFeatures'.
getNotificationFeatures ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse NotificationFeaturesResponse)
getNotificationFeatures = performBHRequest Requests.getNotificationFeatures
-- | 'sendTestNotification' triggers a one-shot probe delivery to a
-- channel. See
-- 'Database.Bloodhound.OpenSearch2.Requests.sendTestNotification'.
sendTestNotification ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m (ParsedEsResponse TestNotificationResponse)
sendTestNotification =
performBHRequest . Requests.sendTestNotification
-- =========================================================================
-- Alerting plugin
-- =========================================================================
-- | 'createMonitor' creates an alerting monitor. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createMonitor' for the
-- underlying request and the wire-shape details.
createMonitor ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Monitor ->
m MonitorResponse
createMonitor monitor = performBHRequest $ Requests.createMonitor monitor
-- | 'getMonitor' fetches a monitor by id. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getMonitor'.
getMonitor ::
(MonadBH m, WithBackend OpenSearch2 m) =>
MonitorId ->
m Monitor
getMonitor monitorId = performBHRequest $ Requests.getMonitor monitorId
-- | 'updateMonitor' replaces a monitor. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateMonitor'.
updateMonitor ::
(MonadBH m, WithBackend OpenSearch2 m) =>
MonitorId ->
Monitor ->
m MonitorResponse
updateMonitor monitorId monitor = performBHRequest $ Requests.updateMonitor monitorId monitor
-- | 'updateMonitorWith' replaces a monitor with an optional
-- optimistic-concurrency guard (@if_seq_no@ \/ @if_primary_term@). See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateMonitorWith'.
updateMonitorWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
MonitorId ->
Monitor ->
Maybe (Word64, Word64) ->
m MonitorResponse
updateMonitorWith monitorId monitor mOcc =
performBHRequest $ Requests.updateMonitorWith monitorId monitor mOcc
-- | 'deleteMonitor' deletes a monitor by id. Returns the bare
-- Elasticsearch delete-document response (see 'DeleteMonitorResponse' for
-- why this deviates from @m 'Acknowledged'@).
deleteMonitor ::
(MonadBH m, WithBackend OpenSearch2 m) =>
MonitorId ->
m DeleteMonitorResponse
deleteMonitor monitorId = performBHRequest $ Requests.deleteMonitor monitorId
-- | 'searchMonitors' searches the monitor store. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchMonitors'.
searchMonitors ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe MonitorsSearchQuery ->
m (ParsedEsResponse SearchMonitorsResponse)
searchMonitors = performBHRequest . Requests.searchMonitors
-- | 'executeMonitor' runs a monitor immediately (out of schedule). See
-- 'Database.Bloodhound.OpenSearch2.Requests.executeMonitor'.
executeMonitor ::
(MonadBH m, WithBackend OpenSearch2 m) =>
MonitorId ->
Maybe ExecuteMonitorRequest ->
m (ParsedEsResponse ExecuteMonitorResponse)
executeMonitor monitorId mRequest =
performBHRequest $ Requests.executeMonitor monitorId mRequest
-- =========================================================================
-- Security Analytics plugin
-- =========================================================================
-- | 'createSADetector' creates a Security Analytics detector. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createSADetector' for the
-- underlying request and the wire-shape details.
createSADetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SADetector ->
m SADetectorResponse
createSADetector detector = performBHRequest $ Requests.createSADetector detector
-- | 'getSADetector' fetches a detector by id. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getSADetector'.
getSADetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
m SADetector
getSADetector detectorId = performBHRequest $ Requests.getSADetector detectorId
-- | 'updateSADetector' replaces a detector. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateSADetector'.
updateSADetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
SADetector ->
m SADetectorResponse
updateSADetector detectorId detector = performBHRequest $ Requests.updateSADetector detectorId detector
-- | 'deleteSADetector' deletes a detector by id. See
-- 'Database.Bloodhound.OpenSearch2.Requests.deleteSADetector'.
deleteSADetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
m DeleteSADetectorResponse
deleteSADetector detectorId = performBHRequest $ Requests.deleteSADetector detectorId
-- | 'searchSAPrePackagedRules' searches the pre-packaged Sigma rules
-- index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchSAPrePackagedRules'
-- for the underlying request and the bead-acceptance deviation note.
searchSAPrePackagedRules ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe SARulesQuery ->
m (ParsedEsResponse SARulesSearchResponse)
searchSAPrePackagedRules = performBHRequest . Requests.searchSAPrePackagedRules
-- | 'searchSACustomRules' searches the custom Sigma rules index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchSACustomRules'.
searchSACustomRules ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe SARulesQuery ->
m (ParsedEsResponse SARulesSearchResponse)
searchSACustomRules = performBHRequest . Requests.searchSACustomRules
-- | 'createSACustomRule' creates a custom Sigma rule. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createSACustomRule' for the
-- underlying request and the raw-YAML-body detail.
createSACustomRule ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SADetectorType ->
Text ->
m SARuleResponse
createSACustomRule category sigmaYaml =
performBHRequest $ Requests.createSACustomRule category sigmaYaml
-- | 'updateSACustomRule' replaces a custom Sigma rule. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateSACustomRule'.
updateSACustomRule ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RuleId ->
SADetectorType ->
Bool ->
Text ->
m SARuleResponse
updateSACustomRule ruleId category forced sigmaYaml =
performBHRequest $ Requests.updateSACustomRule ruleId category forced sigmaYaml
-- | 'deleteSACustomRule' deletes a custom Sigma rule. See
-- 'Database.Bloodhound.OpenSearch2.Requests.deleteSACustomRule'.
deleteSACustomRule ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RuleId ->
Bool ->
m DeleteSARuleResponse
deleteSACustomRule ruleId forced =
performBHRequest $ Requests.deleteSACustomRule ruleId forced
-- | 'searchSADetectors' searches the detector store. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchSADetectors'.
searchSADetectors ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe SADetectorsSearchQuery ->
m (ParsedEsResponse SADetectorsSearchResponse)
searchSADetectors = performBHRequest . Requests.searchSADetectors
-- | 'getSAMappingsView' returns a mappings view for an index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getSAMappingsView'.
getSAMappingsView ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SAMappingsViewRequest ->
m SAMappingsViewResponse
getSAMappingsView = performBHRequest . Requests.getSAMappingsView
-- | 'createSAMappings' creates the field-to-alias mappings for an
-- index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createSAMappings'.
createSAMappings ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SACreateMappingsRequest ->
m Acknowledged
createSAMappings = performBHRequest . Requests.createSAMappings
-- | 'getSAMappings' fetches the persisted mappings for an index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getSAMappings'.
getSAMappings ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m SAGetMappingsResponse
getSAMappings = performBHRequest . Requests.getSAMappings
-- | 'updateSAMappings' updates a single field mapping for an index.
-- See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateSAMappings'.
updateSAMappings ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SAUpdateMappingsRequest ->
m Acknowledged
updateSAMappings = performBHRequest . Requests.updateSAMappings
-- | 'getSAAlertsWith' lists Security Analytics alert documents with the
-- supplied options. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getSAAlertsWith'.
getSAAlertsWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SAGetAlertsOptions ->
m SAGetAlertsResponse
getSAAlertsWith = performBHRequest . Requests.getSAAlertsWith
-- | 'getSAAlerts' lists the alert documents of a single detector. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getSAAlerts'.
getSAAlerts ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
m [SAAlert]
getSAAlerts = performBHRequest . Requests.getSAAlerts
-- | 'acknowledgeSADetectorAlerts' acknowledges one or more active
-- alerts of a detector. See
-- 'Database.Bloodhound.OpenSearch2.Requests.acknowledgeSADetectorAlerts'.
acknowledgeSADetectorAlerts ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
[Text] ->
m AcknowledgeSADetectorAlertsResponse
acknowledgeSADetectorAlerts = (performBHRequest .) . Requests.acknowledgeSADetectorAlerts
-- | 'searchSAFindings' lists Security Analytics finding documents. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchSAFindings'.
searchSAFindings ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SASearchFindingsOptions ->
m (ParsedEsResponse SASearchFindingsResponse)
searchSAFindings = performBHRequest . Requests.searchSAFindings
-- | 'createSACorrelationRule' creates a correlation rule. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createSACorrelationRule'.
createSACorrelationRule ::
(MonadBH m, WithBackend OpenSearch2 m) =>
CreateSACorrelationRuleRequest ->
m CreateSACorrelationRuleResponse
createSACorrelationRule = performBHRequest . Requests.createSACorrelationRule
-- | 'getSACorrelations' lists pairwise finding correlations within a
-- time window. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getSACorrelations'.
getSACorrelations ::
(MonadBH m, WithBackend OpenSearch2 m) =>
GetSACorrelationsOptions ->
m GetSACorrelationsResponse
getSACorrelations = performBHRequest . Requests.getSACorrelations
-- | 'findSACorrelation' lists correlated findings for a given finding.
-- See
-- 'Database.Bloodhound.OpenSearch2.Requests.findSACorrelation'.
findSACorrelation ::
(MonadBH m, WithBackend OpenSearch2 m) =>
FindSACorrelationOptions ->
m FindSACorrelationResponse
findSACorrelation = performBHRequest . Requests.findSACorrelation
-- | 'searchSACorrelationAlerts' lists correlation alerts. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchSACorrelationAlerts'.
searchSACorrelationAlerts ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SearchSACorrelationAlertsOptions ->
m SearchSACorrelationAlertsResponse
searchSACorrelationAlerts = performBHRequest . Requests.searchSACorrelationAlerts
-- | 'acknowledgeSACorrelationAlerts' acknowledges one or more
-- correlation alerts. See
-- 'Database.Bloodhound.OpenSearch2.Requests.acknowledgeSACorrelationAlerts'.
acknowledgeSACorrelationAlerts ::
(MonadBH m, WithBackend OpenSearch2 m) =>
[Text] ->
m AcknowledgeSACorrelationAlertsResponse
acknowledgeSACorrelationAlerts = performBHRequest . Requests.acknowledgeSACorrelationAlerts
-- | 'createSALogType' creates a custom log type. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createSALogType'.
createSALogType ::
(MonadBH m, WithBackend OpenSearch2 m) =>
SALogType ->
m SALogTypeResponse
createSALogType = performBHRequest . Requests.createSALogType
-- | 'searchSALogTypes' searches the log type store. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchSALogTypes'.
searchSALogTypes ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe SALogTypeSearchQuery ->
m (ParsedEsResponse SALogTypesSearchResponse)
searchSALogTypes = performBHRequest . Requests.searchSALogTypes
-- | 'updateSALogType' replaces a custom log type. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateSALogType'.
updateSALogType ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
SALogType ->
m SALogTypeResponse
updateSALogType = (performBHRequest .) . Requests.updateSALogType
-- | 'deleteSALogType' deletes a custom log type. See
-- 'Database.Bloodhound.OpenSearch2.Requests.deleteSALogType'.
deleteSALogType ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m DeleteSALogTypeResponse
deleteSALogType = performBHRequest . Requests.deleteSALogType
-- | 'getDestinations' lists every configured alerting destination.
-- Returns the bare 'Destination' list (the paging envelope is
-- discarded). See
-- 'Database.Bloodhound.OpenSearch2.Requests.getDestinations' for the
-- underlying request and the wire-shape details.
getDestinations ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m [Destination]
getDestinations = performBHRequest Requests.getDestinations
-- | 'getDestinationsWith' is the parameterized variant of
-- 'getDestinations'. Returns the full 'GetDestinationsResponse'
-- envelope (including @totalDestinations@). See
-- 'Database.Bloodhound.OpenSearch2.Requests.getDestinationsWith'.
getDestinationsWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DestinationListOptions ->
m GetDestinationsResponse
getDestinationsWith opts =
performBHRequest $ Requests.getDestinationsWith opts
-- | 'createDestination' creates an alerting destination. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createDestination' for the
-- underlying request and the wire-shape details.
createDestination ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Destination ->
m DestinationResponse
createDestination destination =
performBHRequest $ Requests.createDestination destination
-- | 'updateDestination' replaces a destination. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateDestination'.
updateDestination ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DestinationId ->
Destination ->
m DestinationResponse
updateDestination destId destination =
performBHRequest $ Requests.updateDestination destId destination
-- | 'deleteDestination' deletes a destination by id. Returns the bare
-- Elasticsearch delete-document response (see 'DeleteDestinationResponse'
-- for why this deviates from @m 'Acknowledged'@).
deleteDestination ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DestinationId ->
m DeleteDestinationResponse
deleteDestination destId =
performBHRequest $ Requests.deleteDestination destId
-- | 'getAlertsWith' lists alert documents, returning the full
-- 'GetAlertsResponse' envelope (including @totalAlerts@). See
-- 'Database.Bloodhound.OpenSearch2.Requests.getAlertsWith'.
getAlertsWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
GetAlertsOptions ->
m GetAlertsResponse
getAlertsWith opts = performBHRequest $ Requests.getAlertsWith opts
-- | 'getAlerts' lists every active alert, projecting out the bare
-- @['Alert']@ list. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getAlerts'.
getAlerts ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m [Alert]
getAlerts = performBHRequest Requests.getAlerts
-- | 'acknowledgeAlert' acknowledges one or more active alerts of a
-- monitor. See
-- 'Database.Bloodhound.OpenSearch2.Requests.acknowledgeAlert'.
acknowledgeAlert ::
(MonadBH m, WithBackend OpenSearch2 m) =>
MonitorId ->
[Text] ->
m AcknowledgeAlertResponse
acknowledgeAlert monitorId alertIds =
performBHRequest $ Requests.acknowledgeAlert monitorId alertIds
-- | 'getMonitorStats' fetches alerting scheduler statistics. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getMonitorStats'.
getMonitorStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Text ->
Maybe Text ->
m (ParsedEsResponse MonitorStats)
getMonitorStats mNodeId mMetric =
performBHRequest $ Requests.getMonitorStats mNodeId mMetric
-- | 'createEmailAccount' creates a legacy alerting email account. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createEmailAccount'.
createEmailAccount ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailAccount ->
m EmailAccountResponse
createEmailAccount account =
performBHRequest $ Requests.createEmailAccount account
-- | 'getEmailAccount' fetches an email account by id. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getEmailAccount'.
getEmailAccount ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailAccountId ->
m EmailAccount
getEmailAccount emailAccountId =
performBHRequest $ Requests.getEmailAccount emailAccountId
-- | 'updateEmailAccount' replaces an email account. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateEmailAccount'.
updateEmailAccount ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailAccountId ->
EmailAccount ->
m EmailAccountResponse
updateEmailAccount emailAccountId account =
performBHRequest $ Requests.updateEmailAccount emailAccountId account
-- | 'updateEmailAccountWith' replaces an email account with an optional
-- optimistic-concurrency guard. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateEmailAccountWith'.
updateEmailAccountWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailAccountId ->
EmailAccount ->
Maybe (Word64, Word64) ->
m EmailAccountResponse
updateEmailAccountWith emailAccountId account mOcc =
performBHRequest $ Requests.updateEmailAccountWith emailAccountId account mOcc
-- | 'deleteEmailAccount' deletes an email account by id. Returns the
-- bare Elasticsearch delete-document response (see
-- 'DeleteEmailAccountResponse').
deleteEmailAccount ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailAccountId ->
m DeleteEmailAccountResponse
deleteEmailAccount emailAccountId =
performBHRequest $ Requests.deleteEmailAccount emailAccountId
-- | 'createEmailGroup' creates a legacy alerting email group. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createEmailGroup'.
createEmailGroup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailGroup ->
m EmailGroupResponse
createEmailGroup group =
performBHRequest $ Requests.createEmailGroup group
-- | 'getEmailGroup' fetches an email group by id. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getEmailGroup'.
getEmailGroup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailGroupId ->
m EmailGroup
getEmailGroup emailGroupId =
performBHRequest $ Requests.getEmailGroup emailGroupId
-- | 'updateEmailGroup' replaces an email group. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateEmailGroup'.
updateEmailGroup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailGroupId ->
EmailGroup ->
m EmailGroupResponse
updateEmailGroup emailGroupId group =
performBHRequest $ Requests.updateEmailGroup emailGroupId group
-- | 'updateEmailGroupWith' replaces an email group with an optional
-- optimistic-concurrency guard. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateEmailGroupWith'.
updateEmailGroupWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailGroupId ->
EmailGroup ->
Maybe (Word64, Word64) ->
m EmailGroupResponse
updateEmailGroupWith emailGroupId group mOcc =
performBHRequest $ Requests.updateEmailGroupWith emailGroupId group mOcc
-- | 'deleteEmailGroup' deletes an email group by id. Returns the bare
-- Elasticsearch delete-document response (see 'DeleteEmailGroupResponse').
deleteEmailGroup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
EmailGroupId ->
m DeleteEmailGroupResponse
deleteEmailGroup emailGroupId =
performBHRequest $ Requests.deleteEmailGroup emailGroupId
-- | 'getDestination' fetches a single destination by id. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getDestination'.
getDestination ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DestinationId ->
m GetDestinationsResponse
getDestination destId =
performBHRequest $ Requests.getDestination destId
-- | 'searchEmailAccounts' searches the email account store. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchEmailAccounts'.
searchEmailAccounts ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe EmailAccountSearchQuery ->
m (ParsedEsResponse SearchEmailAccountsResponse)
searchEmailAccounts mQuery =
performBHRequest $ Requests.searchEmailAccounts mQuery
-- | 'searchEmailGroups' searches the email group store. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchEmailGroups'.
searchEmailGroups ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe EmailGroupSearchQuery ->
m (ParsedEsResponse SearchEmailGroupsResponse)
searchEmailGroups mQuery =
performBHRequest $ Requests.searchEmailGroups mQuery
-- | 'searchFindings' searches the findings index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchFindings'.
searchFindings ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe FindingsSearchOptions ->
m (ParsedEsResponse SearchFindingsResponse)
searchFindings mOpts =
performBHRequest $ Requests.searchFindings mOpts
-- | 'createComment' adds a comment to an alert. See
-- 'Database.Bloodhound.OpenSearch2.Requests.createComment'.
createComment ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
CreateCommentRequest ->
m CommentResponse
createComment alertId req =
performBHRequest $ Requests.createComment alertId req
-- | 'updateComment' modifies a comment. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateComment'.
updateComment ::
(MonadBH m, WithBackend OpenSearch2 m) =>
CommentId ->
UpdateCommentRequest ->
m CommentResponse
updateComment commentId req =
performBHRequest $ Requests.updateComment commentId req
-- | 'searchComments' searches comments. See
-- 'Database.Bloodhound.OpenSearch2.Requests.searchComments'.
searchComments ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe CommentSearchQuery ->
m (ParsedEsResponse SearchCommentsResponse)
searchComments mQuery =
performBHRequest $ Requests.searchComments mQuery
-- | 'deleteComment' removes a comment. See
-- 'Database.Bloodhound.OpenSearch2.Requests.deleteComment'.
deleteComment ::
(MonadBH m, WithBackend OpenSearch2 m) =>
CommentId ->
m DeleteCommentResponse
deleteComment commentId =
performBHRequest $ Requests.deleteComment commentId
-- =========================================================================
-- Anomaly Detection plugin
-- =========================================================================
-- | 'createDetector' creates an anomaly detector. See
-- 'Requests.createDetector' for semantics.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#create-anomaly-detector>
createDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Detector ->
m (ParsedEsResponse CreateDetectorResponse)
createDetector = performBHRequest . Requests.createDetector
-- | 'getDetector' fetches a detector by id. See 'Requests.getDetector' for
-- semantics.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#get-detector>
getDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
GetDetectorParams ->
m (ParsedEsResponse GetDetectorResponse)
getDetector detectorId params =
performBHRequest $ Requests.getDetector detectorId params
-- | 'previewDetector' previews a detector on historical data. See
-- 'Requests.previewDetector' for semantics.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#preview-detector>
previewDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
PreviewRequest ->
m (ParsedEsResponse PreviewResponse)
previewDetector detectorId req =
performBHRequest $ Requests.previewDetector detectorId req
-- | 'previewDetectorInline' previews an unpersisted or body-referenced
-- detector. See 'Requests.previewDetectorInline' for semantics.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#preview-detector>
previewDetectorInline ::
(MonadBH m, WithBackend OpenSearch2 m) =>
PreviewRequest ->
m (ParsedEsResponse PreviewResponse)
previewDetectorInline req =
performBHRequest $ Requests.previewDetectorInline req
-- | 'startDetector' starts a detector job. See
-- 'Requests.startDetector' for semantics.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#start-detector-job>
startDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
Maybe StartDetectorJobRequest ->
m (ParsedEsResponse DetectorJobAcknowledgment)
startDetector detectorId mReq =
performBHRequest $ Requests.startDetector detectorId mReq
-- | 'stopDetector' stops a detector job. See 'Requests.stopDetector'
-- for semantics.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#stop-detector-job>
stopDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
Bool ->
m (ParsedEsResponse DetectorJobAcknowledgment)
stopDetector detectorId historical =
performBHRequest $ Requests.stopDetector detectorId historical
-- | 'updateDetector' replaces a detector. See
-- 'Requests.updateDetector' for semantics.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#update-detector>
updateDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
Detector ->
m (ParsedEsResponse CreateDetectorResponse)
updateDetector detectorId detector =
performBHRequest $ Requests.updateDetector detectorId detector
-- | 'updateDetectorWith' replaces a detector with an optional
-- optimistic-concurrency guard. See 'Requests.updateDetectorWith'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#update-detector>
updateDetectorWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
Detector ->
Maybe (Word64, Word64) ->
m (ParsedEsResponse CreateDetectorResponse)
updateDetectorWith detectorId detector mOcc =
performBHRequest $ Requests.updateDetectorWith detectorId detector mOcc
-- | 'deleteDetector' deletes a detector by id. See 'Requests.deleteDetector'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#delete-detector>
deleteDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
m (ParsedEsResponse DeleteDetectorResponse)
deleteDetector detectorId =
performBHRequest $ Requests.deleteDetector detectorId
-- | 'validateDetector' validates a detector configuration. See
-- 'Requests.validateDetector'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#validate-detector>
validateDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ValidateDetectorMode ->
Detector ->
m (ParsedEsResponse ValidateDetectorResponse)
validateDetector mode detector =
performBHRequest $ Requests.validateDetector mode detector
-- | 'searchDetectors' searches the detector-config index. See
-- 'Requests.searchDetectors'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#search-detector>
searchDetectors ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Value ->
m (ParsedEsResponse SearchDetectorsResponse)
searchDetectors mQuery =
performBHRequest $ Requests.searchDetectors mQuery
-- | 'profileDetector' profiles a detector. See 'Requests.profileDetector'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#profile-detector>
profileDetector ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
[Text] ->
Bool ->
Maybe [Entity] ->
m (ParsedEsResponse DetectorProfileResponse)
profileDetector detectorId types allFlag mEntities =
performBHRequest $ Requests.profileDetector detectorId types allFlag mEntities
-- | 'getDetectorStats' fetches plugin statistics. See
-- 'Requests.getDetectorStats'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#get-stats>
getDetectorStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Text ->
Maybe Text ->
m (ParsedEsResponse DetectorStatsResponse)
getDetectorStats mNodeId mStat =
performBHRequest $ Requests.getDetectorStats mNodeId mStat
-- | 'searchDetectorResults' searches the anomaly-result index. See
-- 'Requests.searchDetectorResults'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#search-results>
searchDetectorResults ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Text ->
Maybe Bool ->
Maybe Value ->
m (ParsedEsResponse SearchDetectorResultsResponse)
searchDetectorResults mCustomResultIndex mOnlyCustom mQuery =
performBHRequest $ Requests.searchDetectorResults mCustomResultIndex mOnlyCustom mQuery
-- | 'deleteDetectorResults' deletes anomaly-result documents by query.
-- See 'Requests.deleteDetectorResults'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#delete-results>
deleteDetectorResults ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Value ->
m (ParsedEsResponse DeleteDetectorResultsResponse)
deleteDetectorResults query =
performBHRequest $ Requests.deleteDetectorResults query
-- | 'searchDetectorTasks' searches the detection-state index. See
-- 'Requests.searchDetectorTasks'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#search-task>
searchDetectorTasks ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe Value ->
m (ParsedEsResponse SearchDetectorTasksResponse)
searchDetectorTasks mQuery =
performBHRequest $ Requests.searchDetectorTasks mQuery
-- | 'topAnomalies' returns the top anomaly results for a
-- high-cardinality detector. See 'Requests.topAnomalies'.
-- See <https://docs.opensearch.org/2.18/observing-your-data/ad/api/#get-top-anomaly-results>
topAnomalies ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DetectorId ->
Bool ->
TopAnomaliesRequest ->
m (ParsedEsResponse TopAnomaliesResponse)
topAnomalies detectorId historical req =
performBHRequest $ Requests.topAnomalies detectorId historical req
-- Index Rollups plugin
-- <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/>
-- ----------------------------------------------------------------------------
-- | 'createRollup' creates or replaces an index rollup job. See
-- 'Requests.createRollup'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/#create-or-update-an-index-rollup-job>
createRollup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RollupId ->
Rollup ->
m (ParsedEsResponse RollupResponse)
createRollup rollupId rollup =
performBHRequest $ Requests.createRollup rollupId rollup
-- | 'createRollupWith' creates or replaces an index rollup job with an
-- optional optimistic-concurrency guard. See 'Requests.createRollupWith'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/#create-or-update-an-index-rollup-job>
createRollupWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RollupId ->
Rollup ->
Maybe (Word64, Word64) ->
m (ParsedEsResponse RollupResponse)
createRollupWith rollupId rollup mOcc =
performBHRequest $ Requests.createRollupWith rollupId rollup mOcc
-- | 'getRollup' fetches a rollup job by id. See 'Requests.getRollup'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/#get-an-index-rollup-job>
getRollup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RollupId ->
m (ParsedEsResponse RollupResponse)
getRollup rollupId =
performBHRequest $ Requests.getRollup rollupId
-- | 'getAllRollups' lists every rollup job. See 'Requests.getAllRollups'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/>
getAllRollups ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse Value)
getAllRollups =
performBHRequest $ Requests.getAllRollups
-- | 'deleteRollup' deletes a rollup job by id. See 'Requests.deleteRollup'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/#delete-an-index-rollup-job>
deleteRollup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RollupId ->
m (ParsedEsResponse Value)
deleteRollup rollupId =
performBHRequest $ Requests.deleteRollup rollupId
-- | 'startRollup' starts a rollup job by id. See 'Requests.startRollup'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/#start-or-stop-an-index-rollup-job>
startRollup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RollupId ->
m (ParsedEsResponse Acknowledged)
startRollup rollupId =
performBHRequest $ Requests.startRollup rollupId
-- | 'stopRollup' stops a rollup job by id. See 'Requests.stopRollup'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/#start-or-stop-an-index-rollup-job>
stopRollup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RollupId ->
m (ParsedEsResponse Acknowledged)
stopRollup rollupId =
performBHRequest $ Requests.stopRollup rollupId
-- | 'explainRollup' returns execution metadata for a rollup job by id.
-- See 'Requests.explainRollup'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-rollups/rollup-api/#explain-an-index-rollup-job>
explainRollup ::
(MonadBH m, WithBackend OpenSearch2 m) =>
RollupId ->
m (ParsedEsResponse ExplainRollupResponse)
explainRollup rollupId =
performBHRequest $ Requests.explainRollup rollupId
-- =========================================================================
-- Cross-Cluster Replication (CCR) plugin
-- =========================================================================
-- | 'startReplication' begins replicating a leader index into a follower
-- index on the /follower/ cluster. See
-- 'Database.Bloodhound.OpenSearch2.Requests.startReplication'.
startReplication ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
StartReplicationRequest ->
m (ParsedEsResponse Acknowledged)
startReplication followerIndex req =
performBHRequest $ Requests.startReplication followerIndex req
-- | 'stopReplication' terminates replication and converts the follower
-- index into a standard writable index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.stopReplication'.
stopReplication ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m (ParsedEsResponse Acknowledged)
stopReplication = performBHRequest . Requests.stopReplication
-- | 'pauseReplication' pauses replication of the leader index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.pauseReplication'.
pauseReplication ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m (ParsedEsResponse Acknowledged)
pauseReplication = performBHRequest . Requests.pauseReplication
-- | 'resumeReplication' resumes replication after a pause. See
-- 'Database.Bloodhound.OpenSearch2.Requests.resumeReplication'.
resumeReplication ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m (ParsedEsResponse Acknowledged)
resumeReplication = performBHRequest . Requests.resumeReplication
-- | 'updateReplicationSettings' applies index-level settings to the
-- follower index. See
-- 'Database.Bloodhound.OpenSearch2.Requests.updateReplicationSettings'.
updateReplicationSettings ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
UpdateReplicationSettingsRequest ->
m (ParsedEsResponse Acknowledged)
updateReplicationSettings followerIndex req =
performBHRequest $ Requests.updateReplicationSettings followerIndex req
-- | 'getReplicationStatus' fetches the replication state of a follower
-- index without the @verbose@ flag. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getReplicationStatus'.
getReplicationStatus ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Text ->
m (ParsedEsResponse ReplicationStatusResponse)
getReplicationStatus = performBHRequest . Requests.getReplicationStatus
-- | 'getReplicationStatusWith' is the parameterized variant of
-- 'getReplicationStatus'. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getReplicationStatusWith'.
getReplicationStatusWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
ReplicationStatusOptions ->
Text ->
m (ParsedEsResponse ReplicationStatusResponse)
getReplicationStatusWith opts followerIndex =
performBHRequest $ Requests.getReplicationStatusWith opts followerIndex
-- | 'getLeaderStats' fetches aggregate and per-index read-side counters
-- from the /leader/ cluster. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getLeaderStats'.
getLeaderStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse LeaderStatsResponse)
getLeaderStats = performBHRequest Requests.getLeaderStats
-- | 'getFollowerStats' fetches follower index state counts and write-side
-- throughput from the /follower/ cluster. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getFollowerStats'.
getFollowerStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse FollowerStatsResponse)
getFollowerStats = performBHRequest Requests.getFollowerStats
-- | 'getAutoFollowStats' fetches auto-follow activity and the configured
-- replication rules. See
-- 'Database.Bloodhound.OpenSearch2.Requests.getAutoFollowStats'.
getAutoFollowStats ::
(MonadBH m, WithBackend OpenSearch2 m) =>
m (ParsedEsResponse AutoFollowStatsResponse)
getAutoFollowStats = performBHRequest Requests.getAutoFollowStats
-- | 'createAutoFollowPattern' creates or updates an auto-follow rule.
-- See
-- 'Database.Bloodhound.OpenSearch2.Requests.createAutoFollowPattern'.
createAutoFollowPattern ::
(MonadBH m, WithBackend OpenSearch2 m) =>
CreateAutoFollowPatternRequest ->
m (ParsedEsResponse Acknowledged)
createAutoFollowPattern =
performBHRequest . Requests.createAutoFollowPattern
-- | 'deleteAutoFollowPattern' deletes an auto-follow rule. See
-- 'Database.Bloodhound.OpenSearch2.Requests.deleteAutoFollowPattern'.
deleteAutoFollowPattern ::
(MonadBH m, WithBackend OpenSearch2 m) =>
DeleteAutoFollowPatternRequest ->
m (ParsedEsResponse Acknowledged)
deleteAutoFollowPattern =
performBHRequest . Requests.deleteAutoFollowPattern
-- =========================================================================
-- Index Transforms plugin
-- =========================================================================
-- | 'createTransform' creates or replaces a transform job. See
-- 'Requests.createTransform' for semantics.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
createTransform ::
(MonadBH m, WithBackend OpenSearch2 m) =>
TransformId ->
Transform ->
m (ParsedEsResponse TransformDocumentResponse)
createTransform transformId transform =
performBHRequest $ Requests.createTransform transformId transform
-- | 'updateTransform' replaces a transform job (unconditional). See
-- 'Requests.updateTransform' for semantics.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
updateTransform ::
(MonadBH m, WithBackend OpenSearch2 m) =>
TransformId ->
Transform ->
m (ParsedEsResponse TransformDocumentResponse)
updateTransform transformId transform =
performBHRequest $ Requests.updateTransform transformId transform
-- | 'updateTransformWith' replaces a transform job with an optional
-- optimistic-concurrency guard. See 'Requests.updateTransformWith'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
updateTransformWith ::
(MonadBH m, WithBackend OpenSearch2 m) =>
TransformId ->
Transform ->
Maybe (Word64, Word64) ->
m (ParsedEsResponse TransformDocumentResponse)
updateTransformWith transformId transform mOcc =
performBHRequest $ Requests.updateTransformWith transformId transform mOcc
-- | 'getTransform' fetches a single transform job by id. See
-- 'Requests.getTransform'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
getTransform ::
(MonadBH m, WithBackend OpenSearch2 m) =>
TransformId ->
m (ParsedEsResponse TransformDocumentResponse)
getTransform transformId =
performBHRequest $ Requests.getTransform transformId
-- | 'getTransforms' lists transform jobs, optionally filtered /
-- paginated. See 'Requests.getTransforms'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
getTransforms ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Maybe TransformsListOptions ->
m (ParsedEsResponse GetTransformsResponse)
getTransforms mOpts =
performBHRequest $ Requests.getTransforms mOpts
-- | 'startTransform' starts a transform job. See
-- 'Requests.startTransform'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
startTransform ::
(MonadBH m, WithBackend OpenSearch2 m) =>
TransformId ->
m (ParsedEsResponse Acknowledged)
startTransform transformId =
performBHRequest $ Requests.startTransform transformId
-- | 'stopTransform' stops a transform job. See 'Requests.stopTransform'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
stopTransform ::
(MonadBH m, WithBackend OpenSearch2 m) =>
TransformId ->
m (ParsedEsResponse Acknowledged)
stopTransform transformId =
performBHRequest $ Requests.stopTransform transformId
-- | 'explainTransform' returns the runtime status and statistics of a
-- transform job. See 'Requests.explainTransform'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
explainTransform ::
(MonadBH m, WithBackend OpenSearch2 m) =>
TransformId ->
m (ParsedEsResponse (Maybe TransformExplain))
explainTransform transformId =
performBHRequest $ Requests.explainTransform transformId
-- | 'previewTransform' previews what the transformed target index would
-- look like. See 'Requests.previewTransform'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
previewTransform ::
(MonadBH m, WithBackend OpenSearch2 m) =>
Transform ->
m (ParsedEsResponse PreviewTransformResponse)
previewTransform transform =
performBHRequest $ Requests.previewTransform transform
-- | 'deleteTransform' deletes a transform job by id. See
-- 'Requests.deleteTransform'.
-- See <https://docs.opensearch.org/2.18/im-plugin/index-transforms/transforms-apis/>
deleteTransform ::
(MonadBH m, WithBackend OpenSearch2 m) =>
TransformId ->
m (ParsedEsResponse BulkResponse)
deleteTransform transformId =
performBHRequest $ Requests.deleteTransform transformId