peepshow/ sinks/ elasticsearch

Reel #77 Full-text + search

peepshow sink / elasticsearch

ElasticsearchIndex each run as a doc — full-text search across run history.

POST one JSON document per peepshow run to an Elasticsearch (or OpenSearch — same API) index. Full-text search transcripts, titles, container tags out of the box.

drop · process · elasticsearch

What it does

[Elasticsearch](https://www.elastic.co/elasticsearch/) (and the API-compatible [OpenSearch](https://opensearch.org)) is the de-facto search engine for full-text, faceted, and aggregation queries over high-volume document streams. This sink POSTs one JSON document per peepshow run to `/<index>/_doc`, letting the server assign the id and auto-create the index. Once indexed, run transcripts, titles, and container tags become queryable via Kibana / OpenSearch Dashboards or any Elastic SDK.

When to reach for it

  • Search run history by transcript text — find every video where the agent heard the word "crash"
  • Build a Kibana / OpenSearch Dashboards view over peepshow runs for ops or stakeholders
  • Pipe runs into an existing ELK stack already aggregating product logs

Install

npm i -g peepshow

Use it

ELASTICSEARCH_URL="http://localhost:9200" \
peepshow ./demo.mp4 --sink elasticsearch

Make it automatic

Register the sink once — every run fires it afterward. Scope by --when so it only runs for matching videos.

peepshow sinks add elasticsearch
peepshow sinks add elasticsearch --when extension=mp4,mov
peepshow sinks add elasticsearch --when path=/Volumes/Work/

Configuration

  • ELASTICSEARCH_URL Base URL of the Elasticsearch / OpenSearch cluster, e.g. `https://es.example.com:9200`. required
  • ELASTICSEARCH_INDEX Index name. Default `peepshow-runs`. Auto-created on first write.
  • ELASTICSEARCH_API_KEY Encoded API key (sent as `Authorization: ApiKey <k>`). Preferred over Basic auth.
  • ELASTICSEARCH_USERNAME Basic auth user. Mutually exclusive with `ELASTICSEARCH_API_KEY`.
  • ELASTICSEARCH_PASSWORD Basic auth password. Required when username is set.
  • PEEPSHOW_FRAME_BASE_URL When set, the first frame URL is written to the `thumbnail_url` field.

Use with an LLM agent

Every peepshow sink reads its config from env vars and receives a single JSON payload on stdin. An LLM agent (Claude Code, Cursor, Windsurf, Gemini, Codex) can drive the Elasticsearch sink automatically when three things are true:

  • the env vars below are exported in the agent's shell (or a project .env it can load),
  • the peepshow CLI is on PATH — install with npm i -g peepshow,
  • a peepshow auto-sink is registered for the run (optional but recommended — makes invocation zero-argument).

1. Set the environment

# Add to ~/.zshrc, ~/.bashrc, or a project .env the agent can load
export ELASTICSEARCH_URL="..."

2. Register as an auto-sink

peepshow sinks add elasticsearch
peepshow sinks add elasticsearch --when extension=mp4,mov

3. Example LLM session

You → drop a .mov into Claude Code.

Claude → auto-invokes /peepshow:slides ./clip.mov. peepshow extracts frames + audio, the Elasticsearch sink forwards the run to the configured collection. Claude replies with a summary and a link to the created record.

The transcript text is a natural embedding target — index it next to the frames.

Write your own

A sink is any executable that reads the --emit json payload on stdin. Shell, Node, Python, Go — the spec's in docs/PLUGINS.md. Register persistent ones with peepshow sinks add-cmd 'your-command'.