Skip to content

AWS.OpenSearch reference

Source: src/AWS/OpenSearch/CancelServiceSoftwareUpdate.ts

Runtime binding for the CancelServiceSoftwareUpdate operation (IAM action es:CancelServiceSoftwareUpdate).

Cancels a scheduled service software update — only while the update is in the PENDING_UPDATE state. Provide the implementation with Effect.provide(AWS.OpenSearch.CancelServiceSoftwareUpdateHttp).

CancelServiceSoftwareUpdate: Service Software Updates

Section titled “CancelServiceSoftwareUpdate: Service Software Updates”
const cancelServiceSoftwareUpdate = yield* OpenSearch.CancelServiceSoftwareUpdate();
const result = yield* cancelServiceSoftwareUpdate({ DomainName: name });
// result.ServiceSoftwareOptions?.UpdateStatus → "NOT_ELIGIBLE" | "ELIGIBLE"

Source: src/AWS/OpenSearch/DescribeDomain.ts

Runtime binding for the DescribeDomain operation (IAM action es:DescribeDomain).

Reads a domain’s current status — endpoint, engine version, creation and processing state — e.g. an operational health check that verifies a domain is active before routing search traffic. Provide the implementation with Effect.provide(AWS.OpenSearch.DescribeDomainHttp).

const describeDomain = yield* OpenSearch.DescribeDomain();
const result = yield* describeDomain({ DomainName: name });
// result.DomainStatus.Processing → false

Source: src/AWS/OpenSearch/DescribeDomainAutoTunes.ts

Runtime binding for the DescribeDomainAutoTunes operation (IAM action es:DescribeDomainAutoTunes).

Lists the Auto-Tune optimizations scheduled for a domain — e.g. to surface upcoming JVM heap or queue tuning actions to operators. Provide the implementation with Effect.provide(AWS.OpenSearch.DescribeDomainAutoTunesHttp).

DescribeDomainAutoTunes: Auto-Tune and Scheduled Actions

Section titled “DescribeDomainAutoTunes: Auto-Tune and Scheduled Actions”
const describeDomainAutoTunes = yield* OpenSearch.DescribeDomainAutoTunes();
const result = yield* describeDomainAutoTunes({ DomainName: name });
// result.AutoTunes → scheduled optimizations

Source: src/AWS/OpenSearch/DescribeDomainChangeProgress.ts

Runtime binding for the DescribeDomainChangeProgress operation (IAM action es:DescribeDomainChangeProgress).

Tracks the stage-by-stage progress of a domain’s in-flight configuration change (blue/green deployment) — e.g. to report how far along a cluster resize is. Provide the implementation with Effect.provide(AWS.OpenSearch.DescribeDomainChangeProgressHttp).

DescribeDomainChangeProgress: Monitoring Domains

Section titled “DescribeDomainChangeProgress: Monitoring Domains”
const describeDomainChangeProgress = yield* OpenSearch.DescribeDomainChangeProgress();
const result = yield* describeDomainChangeProgress({ DomainName: name });
// result.ChangeProgressStatus?.Status → "COMPLETED"

Source: src/AWS/OpenSearch/DescribeDomainConfig.ts

Runtime binding for the DescribeDomainConfig operation (IAM action es:DescribeDomainConfig).

Reads a domain’s full configuration, with per-option status metadata (update date, state, pending values) — the authoritative view of what a blue/green change is converging toward. Provide the implementation with Effect.provide(AWS.OpenSearch.DescribeDomainConfigHttp).

const describeDomainConfig = yield* OpenSearch.DescribeDomainConfig();
const result = yield* describeDomainConfig({ DomainName: name });
// result.DomainConfig.ClusterConfig?.Status.State → "Active"

Source: src/AWS/OpenSearch/DescribeDomainHealth.ts

Runtime binding for the DescribeDomainHealth operation (IAM action es:DescribeDomainHealth).

Reads a domain’s cluster health — overall status, master eligibility, per-AZ shard and node distribution — for dashboards and automated health checks. Provide the implementation with Effect.provide(AWS.OpenSearch.DescribeDomainHealthHttp).

const describeDomainHealth = yield* OpenSearch.DescribeDomainHealth();
const result = yield* describeDomainHealth({ DomainName: name });
// result.ClusterHealth → "Green"

Source: src/AWS/OpenSearch/DescribeDomainNodes.ts

Runtime binding for the DescribeDomainNodes operation (IAM action es:DescribeDomainNodes).

Lists a domain’s individual nodes — type (data/master/UltraWarm), Availability Zone, instance type, and storage — for node-level diagnostics. Provide the implementation with Effect.provide(AWS.OpenSearch.DescribeDomainNodesHttp).

const describeDomainNodes = yield* OpenSearch.DescribeDomainNodes();
const result = yield* describeDomainNodes({ DomainName: name });
// result.DomainNodesStatusList → one entry per node

Source: src/AWS/OpenSearch/DescribeDomains.ts

Runtime binding for the DescribeDomains operation (IAM action es:DescribeDomains).

Reads the current status of up to five domains in one call — the batch form of DescribeDomain. Provide the implementation with Effect.provide(AWS.OpenSearch.DescribeDomainsHttp).

const describeDomains = yield* OpenSearch.DescribeDomains();
const result = yield* describeDomains({ DomainNames: [a, b] });
// result.DomainStatusList → one status per domain

Source: src/AWS/OpenSearch/Domain.ts

An Amazon OpenSearch Service domain — a managed OpenSearch/Elasticsearch cluster with a search/HTTP endpoint.

Domains take roughly 15-25 minutes to provision (and about as long for blue/green configuration changes) and are billed per instance-hour while they exist. Destroy domains you are not using.

Minimal Domain

// A single t3.small.search node with 10 GiB of gp3 EBS storage.
const domain = yield* Domain("Search", {});

Encrypted Domain with Access Policy

const domain = yield* Domain("Search", {
engineVersion: "OpenSearch_2.19",
clusterConfig: { instanceType: "t3.small.search", instanceCount: 1 },
ebsOptions: { volumeType: "gp3", volumeSize: 10 },
encryptionAtRest: { enabled: true },
nodeToNodeEncryption: true,
domainEndpointOptions: {
enforceHTTPS: true,
tlsSecurityPolicy: "Policy-Min-TLS-1-2-2019-07",
},
accessPolicies: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: { AWS: `arn:aws:iam::${accountId}:root` },
Action: ["es:*"],
Resource: `arn:aws:es:${region}:${accountId}:domain/*`,
},
],
},
});
const domain = yield* Domain("Search", {
clusterConfig: {
instanceType: "r7g.large.search",
instanceCount: 2,
zoneAwarenessEnabled: true,
availabilityZoneCount: 2,
},
});

Source: src/AWS/OpenSearch/DomainRead.ts

Runtime binding for read-only access to an OpenSearch Domain’s REST data plane (IAM actions es:ESHttpGet and es:ESHttpHead on the domain and its paths).

Every request is a SigV4-signed HTTP call (service es) against the domain’s endpoint, made with the host Function’s own credentials — the domain’s access policy must allow the function’s role. Provide the implementation with Effect.provide(AWS.OpenSearch.DomainReadHttp).

Search Documents

// init — grants es:ESHttpGet/es:ESHttpHead on the domain
const search = yield* AWS.OpenSearch.DomainRead(domain);
// runtime
const result = yield* search.search<{ title: string }>({
index: "songs",
body: { query: { match: { title: "wind" } } },
});
const titles = result.hits.hits.map((hit) => hit._source.title);

Fetch One Document

const doc = yield* search.getDocument<{ title: string }>("songs", "1");
if (doc.found) yield* Effect.log(doc._source?.title);

Source: src/AWS/OpenSearch/DomainReadWrite.ts

Runtime binding for full read/write access to an OpenSearch Domain’s REST data plane (IAM action es:ESHttp* on the domain and its paths).

Every request is a SigV4-signed HTTP call (service es) against the domain’s endpoint, made with the host Function’s own credentials — the domain’s access policy must allow the function’s role. Prefer the least-privilege DomainRead / DomainWrite bindings when one direction suffices. Provide the implementation with Effect.provide(AWS.OpenSearch.DomainReadWriteHttp).

DomainReadWrite: Reading and Writing a Domain

Section titled “DomainReadWrite: Reading and Writing a Domain”

Index Then Search

// init — grants es:ESHttp* on the domain
const client = yield* AWS.OpenSearch.DomainReadWrite(domain);
// runtime
yield* client.indexDocument(
"songs",
{ title: "The Wind Cries Mary" },
{ id: "1", refresh: true },
);
const result = yield* client.search({
index: "songs",
body: { query: { match: { title: "wind" } } },
});

Create an Index With Explicit Mappings

yield* client.request("PUT", "songs", {
body: { mappings: { properties: { title: { type: "text" } } } },
});

Source: src/AWS/OpenSearch/DomainWrite.ts

Runtime binding for write access to an OpenSearch Domain’s REST data plane (IAM actions es:ESHttpPut, es:ESHttpPost, es:ESHttpDelete and es:ESHttpPatch on the domain and its paths).

Every request is a SigV4-signed HTTP call (service es) against the domain’s endpoint, made with the host Function’s own credentials — the domain’s access policy must allow the function’s role. Provide the implementation with Effect.provide(AWS.OpenSearch.DomainWriteHttp).

// init — grants es:ESHttpPut/Post/Delete/Patch on the domain
const writer = yield* AWS.OpenSearch.DomainWrite(domain);
// runtime
yield* writer.indexDocument(
"songs",
{ title: "The Wind Cries Mary" },
{ id: "1", refresh: true },
);
yield* writer.deleteDocument("songs", "1", { refresh: true });

Source: src/AWS/OpenSearch/GetCompatibleVersions.ts

Runtime binding for the GetCompatibleVersions operation (IAM action es:GetCompatibleVersions).

Maps engine versions to the versions they can be upgraded to — for one domain (pass DomainName) or for every supported version. Provide the implementation with Effect.provide(AWS.OpenSearch.GetCompatibleVersionsHttp).

const getCompatibleVersions = yield* OpenSearch.GetCompatibleVersions();
const result = yield* getCompatibleVersions({ DomainName: name });
// result.CompatibleVersions?.[0]?.TargetVersions → upgrade targets

Source: src/AWS/OpenSearch/GetDomainMaintenanceStatus.ts

Runtime binding for the GetDomainMaintenanceStatus operation (IAM action es:GetDomainMaintenanceStatus).

Reads the status of one in-progress or completed maintenance action started with StartDomainMaintenance. Provide the implementation with Effect.provide(AWS.OpenSearch.GetDomainMaintenanceStatusHttp).

GetDomainMaintenanceStatus: Domain Maintenance

Section titled “GetDomainMaintenanceStatus: Domain Maintenance”
const getDomainMaintenanceStatus = yield* OpenSearch.GetDomainMaintenanceStatus();
const result = yield* getDomainMaintenanceStatus({
DomainName: name,
MaintenanceId: maintenanceId,
});
// result.Status → "COMPLETED"

Source: src/AWS/OpenSearch/GetUpgradeHistory.ts

Runtime binding for the GetUpgradeHistory operation (IAM action es:GetUpgradeHistory).

Lists a domain’s past engine-version upgrades and upgrade-eligibility checks, with per-step progress. Provide the implementation with Effect.provide(AWS.OpenSearch.GetUpgradeHistoryHttp).

const getUpgradeHistory = yield* OpenSearch.GetUpgradeHistory();
const result = yield* getUpgradeHistory({ DomainName: name });
// result.UpgradeHistories → past upgrades

Source: src/AWS/OpenSearch/GetUpgradeStatus.ts

Runtime binding for the GetUpgradeStatus operation (IAM action es:GetUpgradeStatus).

Reads the status of a domain’s most recent engine-version upgrade or upgrade-eligibility check. Provide the implementation with Effect.provide(AWS.OpenSearch.GetUpgradeStatusHttp).

const getUpgradeStatus = yield* OpenSearch.GetUpgradeStatus();
const result = yield* getUpgradeStatus({ DomainName: name });
// result.StepStatus → "SUCCEEDED"

Source: src/AWS/OpenSearch/ListDomainMaintenances.ts

Runtime binding for the ListDomainMaintenances operation (IAM action es:ListDomainMaintenances).

Lists a domain’s maintenance actions — status and timestamps of past and in-progress reboots and process restarts. Provide the implementation with Effect.provide(AWS.OpenSearch.ListDomainMaintenancesHttp).

ListDomainMaintenances: Domain Maintenance

Section titled “ListDomainMaintenances: Domain Maintenance”
const listDomainMaintenances = yield* OpenSearch.ListDomainMaintenances();
const result = yield* listDomainMaintenances({ DomainName: name });
// result.DomainMaintenances → maintenance history

Source: src/AWS/OpenSearch/ListDomainNames.ts

Runtime binding for the ListDomainNames operation (IAM action es:ListDomainNames).

Lists the names and engine types of all domains the account owns in the active Region — the entry point for fleet-wide monitoring. Provide the implementation with Effect.provide(AWS.OpenSearch.ListDomainNamesHttp).

const listDomainNames = yield* OpenSearch.ListDomainNames();
const result = yield* listDomainNames();
// result.DomainNames → [{ DomainName, EngineType }, …]

Source: src/AWS/OpenSearch/ListInstanceTypeDetails.ts

Runtime binding for the ListInstanceTypeDetails operation (IAM action es:ListInstanceTypeDetails).

Lists the instance types (and their capabilities — encryption, warm storage, app logs) supported by an engine version, e.g. to validate a resize before applying it. Provide the implementation with Effect.provide(AWS.OpenSearch.ListInstanceTypeDetailsHttp).

const listInstanceTypeDetails = yield* OpenSearch.ListInstanceTypeDetails();
const result = yield* listInstanceTypeDetails({
EngineVersion: "OpenSearch_2.19",
});
// result.InstanceTypeDetails → supported instance types

Source: src/AWS/OpenSearch/ListScheduledActions.ts

Runtime binding for the ListScheduledActions operation (IAM action es:ListScheduledActions).

Lists the actions scheduled on a domain — service software updates, blue/green Auto-Tune changes — with their scheduled time and severity. Provide the implementation with Effect.provide(AWS.OpenSearch.ListScheduledActionsHttp).

ListScheduledActions: Auto-Tune and Scheduled Actions

Section titled “ListScheduledActions: Auto-Tune and Scheduled Actions”
const listScheduledActions = yield* OpenSearch.ListScheduledActions();
const result = yield* listScheduledActions({ DomainName: name });
// result.ScheduledActions → pending actions

Source: src/AWS/OpenSearch/ListVersions.ts

Runtime binding for the ListVersions operation (IAM action es:ListVersions).

Lists every OpenSearch and Elasticsearch version the service supports — e.g. to validate an upgrade target before calling the upgrade API. Provide the implementation with Effect.provide(AWS.OpenSearch.ListVersionsHttp).

const listVersions = yield* OpenSearch.ListVersions();
const result = yield* listVersions();
// result.Versions → ["OpenSearch_2.19", …]

Source: src/AWS/OpenSearch/StartDomainMaintenance.ts

Runtime binding for the StartDomainMaintenance operation (IAM action es:StartDomainMaintenance).

Starts a maintenance action on a domain — reboot a node, restart the search process, or restart Dashboards — e.g. remediation triggered by a health alarm. Provide the implementation with Effect.provide(AWS.OpenSearch.StartDomainMaintenanceHttp).

StartDomainMaintenance: Domain Maintenance

Section titled “StartDomainMaintenance: Domain Maintenance”
const startDomainMaintenance = yield* OpenSearch.StartDomainMaintenance();
const result = yield* startDomainMaintenance({
DomainName: name,
Action: "REBOOT_NODE",
NodeId: nodeId,
});
// result.MaintenanceId → track with GetDomainMaintenanceStatus

Source: src/AWS/OpenSearch/StartServiceSoftwareUpdate.ts

Runtime binding for the StartServiceSoftwareUpdate operation (IAM action es:StartServiceSoftwareUpdate).

Schedules a service software update for a domain — immediately, at a timestamp, or in the domain’s off-peak window — e.g. rolling out a pending security patch fleet-wide. Provide the implementation with Effect.provide(AWS.OpenSearch.StartServiceSoftwareUpdateHttp).

StartServiceSoftwareUpdate: Service Software Updates

Section titled “StartServiceSoftwareUpdate: Service Software Updates”
const startServiceSoftwareUpdate = yield* OpenSearch.StartServiceSoftwareUpdate();
const result = yield* startServiceSoftwareUpdate({ DomainName: name });
// result.ServiceSoftwareOptions?.UpdateStatus → "PENDING_UPDATE"