npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@agstack/storage-elasticsearch

v0.1.0

Published

Enterprise-grade Elasticsearch/OpenSearch storage plugin for AGStack — bulk indexing, ILM, index templates, aliases, and async background workers

Readme

@agstack/storage-elasticsearch

Enterprise-grade Elasticsearch/OpenSearch storage plugin for AGStack

The official search backend for the AGStack ecosystem. Indexes transactions asynchronously through the AGStack Worker Pool using the Elasticsearch Bulk API. Compatible with OpenSearch 2+.

Features

  • Async Bulk Indexing — Never index one document at a time. Configurable batch size, flush interval, concurrency
  • Index Lifecycle Management — Hot/Warm/Cold/Delete phases, automatic rollover, retention
  • Index Templates — Composable templates, component templates, automatic creation
  • Index Aliases — Write aliases, read aliases, multi-tenant support
  • Connection Management — Connection pooling, node discovery, sniffing, TLS, compression
  • Authentication — API keys, Basic auth, Bearer tokens, Elastic Cloud
  • Failure Recovery — Retry queue, dead letter queue, partial failure handling, automatic backoff
  • Health & Metrics — Cluster health, bulk throughput, indexing latency, failed documents
  • Search Optimized — Keyword, text, date, IP, geo_point, nested objects, flattened fields

Installation

npm install @agstack/storage-elasticsearch @elastic/elasticsearch@8

Quick Start

import { StorageElasticsearchPlugin, DEFAULTS, validateConfig } from "@agstack/storage-elasticsearch";
import { createRuntime } from "@agstack/logger";

const runtime = createRuntime({
  plugins: [
    () => {
      const plugin = new StorageElasticsearchPlugin();
      runtime.registerPlugin("storage-elasticsearch", plugin, {
        options: validateConfig({
          nodes: [{ url: "http://localhost:9200" }],
          auth: { type: "api-key", apiKey: process.env.ES_API_KEY },
          index: {
            prefix: "transactions",
            strategy: "daily",
            shards: 3,
            replicas: 1,
          },
          bulk: {
            batchSize: 500,
            flushIntervalMs: 5000,
          },
        }),
      });
      return plugin;
    },
  ],
});

await runtime.start();

Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | nodes | EsNodeConfig[] | [] | Elasticsearch node URLs | | cloudId | string | "" | Elastic Cloud ID | | auth.type | AuthType | "none" | Authentication type | | index.prefix | string | "agstack" | Index name prefix | | index.strategy | IndexStrategy | "daily" | Index naming strategy | | index.shards | number | 1 | Number of primary shards | | index.replicas | number | 0 | Number of replica shards | | bulk.batchSize | number | 500 | Documents per bulk request | | bulk.flushIntervalMs | number | 5000 | Auto-flush interval | | bulk.concurrency | number | 2 | Concurrent bulk workers | | workerCount | number | 2 | Background workers |

Architecture

Runtime → Plugin → BulkBuilder → Bulk API → Elasticsearch/OpenSearch
                         ↓                    ↓
                    Retry Queue           Index Manager
                         ↓              (templates, ILM,
                    Dead Letter Queue     aliases, mappings)

Index Strategies

  • daily{prefix}-YYYY.MM.DD
  • monthly{prefix}-YYYY.MM
  • app-based{prefix}-{app}-YYYY.MM
  • env-based{prefix}-{env}-YYYY.MM.DD
  • custom — Template-based pattern

ILM Policy

When index.ilmEnabled is true, the plugin creates an ILM policy with configurable:

  • Hot phase rollover (max size, age, docs)
  • Warm phase (shrink, forcemerge)
  • Cold phase (freeze)
  • Delete phase (retention)

License

MIT