Skip to content

DomainWrite

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 });