upstash-search-js
This skill covers Upstash Search fundamentals for TypeScript and JavaScript developers. It walks through SDK installation, creating indexes, upserting documents, and executing searches with optional filtering and reranking. Use it to understand core concepts like content versus metadata and to implement end-to-end search workflows.
upstash-search-js teaches you to set up Upstash Search and perform indexing and search queries using the TypeScript SDK.
AI-generated summary based on this skill's SKILL.md
Install
upstash/skills/upstash-search-js · repository language: JavaScript
git clone https://github.com/upstash/skills
cp -r skills/skills/upstash-search-js ~/.claude/skills/upstash-search-jsnpx skillfed install upstash/skills/upstash-search-jsFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I use Upstash Search with JavaScript?
upstash-search-js is a TypeScript/JavaScript SDK for Upstash Search. Install it via npm, initialize a client with your index URL and token, then upsert documents and execute searches. The SDK handles REST API calls under the hood, letting you focus on indexing and querying workflows without manual HTTP setup.
How do I index documents in Upstash Search?
upstash-search-js uses the upsert operation to add or update documents. Pass an array of objects with id, content (full-text searchable), and metadata (filterable fields) to the upsert method. Content is indexed for keyword matching; metadata enables filtering and range queries on structured fields without affecting search relevance.
What's the difference between metadata and content in upstash-search-js?
In upstash-search-js, content is the full-text searchable body of a document—keywords are extracted and indexed here. Metadata holds structured, filterable attributes like category, price, or date that you can query with filters and range conditions, but metadata is not used for keyword matching in the search itself.
How do I set up the upstash-search-js client in TypeScript?
upstash-search-js requires your index URL and API token from the Upstash console. Import the Index class, instantiate it with these credentials, and you're ready to call methods like upsert, search, fetch, and delete. The SDK is fully typed, so TypeScript will guide you through available operations and parameters.
Can upstash-search-js filter and rerank search results?
Yes. upstash-search-js supports filtering via metadata predicates (e.g., category = 'tech') and range queries on numeric or date fields. Reranking lets you boost or adjust result order based on custom logic. Combine these features in a single search call to refine results by relevance, filters, and custom ranking rules.
What are common pitfalls and best practices for upstash-search-js?
upstash-search-js works best when you keep content focused on searchable text and metadata for filtering. Avoid storing large unstructured data in metadata; use fetch-by-id for full documents instead. Batch upserts when possible, validate index creation before use, and test filter predicates early to catch schema mismatches.
SKILL.md
rendered from the published skill — quoted content, verbatim
Upstash Search Documentation
Quick Start
Install the TS SDK:
npm install @upstash/search
Create a client and perform a simple upsert + search:
import { Search } from "@upstash/search";
const client = new Search({ url: process.env.UPSTASH_SEARCH_REST_URL, token: process.env.UPSTASH_SEARCH_REST_TOKEN });
const index = client.index("my-index");
await index.upsert({ id: "1", content: { text: "hello world" } });
const results = await index.search({ query: "hello" });
Basic steps: - Create an index - Insert or update documents - Run searches or filtered queries
Other Skill Files
sdk-overview
Provides detailed documentation for all TypeScript SDK commands. Includes: - delete: Deleting documents - fetch: Retrieving a document - info: Index info - range: Range queries - reset: Clearing an index - search: Search queries - upsert: Adding/updating documents - getting-started: Setup steps for the SDK
quick-start
Provides a
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 3 files
skills/upstash-search-js/SKILL.md
skills/upstash-search-js/quick-start.md
skills/upstash-search-js/sdk-overview.md