Skip to content
Eight Effect-native API SDKs are live.Explore the catalog
Distilled
Esc
navigateopen⌘Jpreview
On this page

OpenSearch SDK

Install, authenticate, and query OpenSearch with Effect-native operations generated from OpenAPI 3.1.

Public package OpenAPI 3.1 684 operations

The 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 effect
pnpm add @kevinmichaelchen/distilled-opensearch effect
bun add @kevinmichaelchen/distilled-opensearch effect

Authentication

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

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.

Last updated on July 15, 2026

Was this page helpful?