DomainReadWrite
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).
Reading and Writing a Domain
Section titled “Reading and Writing a Domain”Index Then Search
// init — grants es:ESHttp* on the domainconst client = yield* AWS.OpenSearch.DomainReadWrite(domain);
// runtimeyield* 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" } } } },});