OpenSearch SDK
Install, authenticate, and query OpenSearch with Effect-native operations generated from OpenAPI 3.1.
Public package OpenAPI 3.1 684 operationsThe OpenSearch SDK pins the project’s official client-generation contract and keeps cluster addressing, authentication, error mapping, and retry policy in the handwritten provider layer.
Install
npm install @kevinmichaelchen/distilled-opensearch effectpnpm add @kevinmichaelchen/distilled-opensearch effectbun add @kevinmichaelchen/distilled-opensearch effectAuthentication
| Variable | Purpose |
|---|---|
OPENSEARCH_URL |
Cluster endpoint |
OPENSEARCH_USERNAME + OPENSEARCH_PASSWORD |
Optional basic-auth credentials |
OPENSEARCH_TOKEN |
Optional bearer token instead of basic auth |
An unsecured local cluster can use only OPENSEARCH_URL. Amazon OpenSearch Service requires a separately supplied AWS Signature Version 4 HTTP client layer; this non-cloud-specific package deliberately does not import an AWS SDK.
Quickstart
Search the latest checkout errors across an index pattern:
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import {
CredentialsFromEnv,
search2,
} from "@kevinmichaelchen/distilled-opensearch";
const OpenSearchLive = Layer.mergeAll(
FetchHttpClient.layer,
CredentialsFromEnv,
);
const program = search2({
index: "application-logs-*",
q: "level:error AND service:checkout",
size: 25,
sort: "@timestamp:desc",
});
const errors = await Effect.runPromise(Effect.provide(program, OpenSearchLive));
Source and package
npm package
Public package, generated source, declarations, and release history.
Implementation (private)
Cluster policy and 684 committed Effect operations.
Specification (private)
Immutable mirror of OpenSearch’s published OpenAPI release.
OpenSearch publishes distinct path-form variants. Dotted IDs become ordinary lower camelCase names such as clusterHealth0; official numeric suffixes such as search2 remain to preserve one-to-one traceability.