Search Index
Searching your Index
By the end of this guide, you will know how to search across all your collections, scope a search to a specific collection, tune result count, interpret relevance scores, and pipe results into scripts.
Want Claude, Codex, Cursor, or Copilot to search for you? → MCP Integration
Prerequisites
- Indexed installed and at least one collection created (see Indexing Overview)
Basic Search
indexed index search "authentication guide"The card layout shows, per hit: the collection, the document, the chunk position, a relevance score, and an excerpt. Scores are ordering guidance within one response — see 4. Understanding scores.
Output field reference:
| Field | Description |
|---|---|
[collection] | The name of the collection this result came from |
document | File path, ticket ID, or page title |
(chunk N/M) | This chunk's position within the document |
Score | Raw engine score for this chunk; the row order is the ranking (see Understanding Scores) |
| Excerpt | A short text preview of the matching chunk |
Scoped Search
Use -c to search only one collection. This is useful when you know the answer is in a specific source — for example, searching only your Jira collection for a ticket, or only your docs collection for a procedure.
indexed index search "rate limiting" -c eng-ticketsWithout -c, Indexed searches all collections and merges results by score.
Tuning Results
More results — increase the limit with -l when the default ten results aren't enough (the default comes from core.v1.search.max_docs; the flag itself has no ceiling). Useful when doing exploratory research or when you know a topic appears in many chunks:
indexed index search "deployment pipeline" -l 20Compact list — same search, but a condensed list instead of the default card layout (first hit expanded, following rows summarized). Good for scanning many hits or terminal width. See the flag table in Index commands.
indexed index search "deploy" --compactNo content previews — hide chunk text previews so the terminal shows metadata-oriented rows (collection, document, chunk position, score). Pairs well with high -l when you only need “what matched.”
indexed index search "deploy" --no-contentReranking — v2 collections can rerank the retrieved hits with a cross-encoder. It is off by default; enable it for one search with --rerank, or turn it on for every search in [core.v2.rerank]:
indexed index search "deploy" --rerankReranking is v2-only. On an index that holds no v2 collection the command says so and returns the unreranked result set.
Understanding Scores
The default card view prints the rows in order and a Score beside each one. The order is the ranking — best first. The number is the engine's raw score for that chunk: not a percentage, and for a v1 collection a squared distance, so a lower number is the closer match. Compare it only within one score_kind — two collections on the same engine generation, never a v1 against a v2. When the result set contains a v2 collection — mixed or v2-only — the card view also shows the comparable 0–1 value: a Relevance row on the top-result card, and rel <value> on each of the other-matches lines.
In the JSON payload the two roles are separate fields:
relevance— 0–1 in normal use, higher is better, and comparable across collections and engines. Rank, sort and threshold on this one.score— the raw engine number behind it, rounded to four decimals. Only comparable within onescore_kind.
A v1 and a v2 collection do not share a score scale
score_kind tells you which scale you are on: l2_squared for v1 collections, cosine or rerank for v2. The v1 number is a squared distance, so it shrinks as the match improves; the v2 numbers grow. Never compare a score from a v1 collection with one from a v2 collection, and never reuse a single numeric cutoff across both. relevance is the field that is comparable — it is derived per kind (1 - score/2 for l2_squared, the score itself for cosine, a sigmoid of the logit for rerank), so it is normally 0–1 but is not clamped.
If you need hard cutoffs, tune [core.v1.search] in your workspace config.toml (for example score_threshold) and validate against your own queries.
Search Tips
- Use natural language, not keywords. "How do we rotate API keys?" performs better than "api key rotation".
- Describe the concept, not the exact words. The index understands that "authentication timeout" and "SSO session drop" are related concepts.
- Longer queries often score better. Adding context helps the embedding model understand your intent.
- Try rephrasing if results are poor. If the first query returns weak results, approach the same topic from a different angle — use synonyms or describe the problem rather than the solution.
- Semantic search works best across a rich corpus. Collections with many documents produce more discriminating scores than collections with just a handful of files.
JSON and scripting
Add --json to the search command for the machine payload. It prints the documented object — schema: "indexed.search/1" — and the MCP tools return that same object, so a script and an agent read one shape (MCP commands). The full field list is in Index commands → Search output.
indexed index search "deploy" -l 10 --jsonThe older global --simple-output flag (placed before index) still works on search and means the same thing; prefer --json.
Example response — the same docs-demo collection, top document only (-l 1; your paths and numbers will differ):
{
"schema": "indexed.search/1",
"query": "how is the cache keyed and invalidated",
"counts": {
"documents": 1,
"hits": 3
},
"collections": [
"docs-demo"
],
"collection_errors": [],
"documents": [
{
"collection": "docs-demo",
"source_type": "localFiles",
"id": "cache.py",
"path": "/home/agent/demo-corpus/demo/cache.py",
"score_kind": "l2_squared",
"hits": [
{
"relevance": 0.4783,
"score": 1.0434,
"locator": {
"kind": "line_span",
"start_line": 9,
"end_line": 11
},
"text": "def cache_get(store, collection, doc_id):\n key = cache_key(collection, doc_id)\n return store.get(key)"
},
{
"relevance": 0.4714,
"score": 1.0571,
"locator": {
"kind": "line_span",
"start_line": 4,
"end_line": 6
},
"text": "def cache_key(collection, doc_id):\n \"\"\"Stable cache key for one document of a collection.\"\"\"\n return f\"{collection}:{doc_id}\""
},
{
"relevance": 0.462,
"score": 1.0761,
"locator": {
"kind": "document"
},
"text": "cache.py"
}
]
}
]
}documents is ordered by best hit, and each one states its collection, source_type, id, path/url and score_kind once; its hits carry relevance (rank on this), score (raw — see Understanding Scores), a locator and the chunk text.
Combine with -c / -l on the command line as usual; --compact and --no-content shape the human view only, and --json ignores them.
Shell pipelines
Pipe --json into jq when a script needs fields; pipe --compact when a human reads the output.
# Document ids and their best relevance, one per line
indexed index search "how is the cache keyed and invalidated" --json \
| jq -r '.documents[] | "\(.id)\t\(.hits[0].relevance)"'# Get the top 5 compact results and show only the first line of each
indexed index search "deploy" --compact | head -5# Search and save results to a file
indexed index search "architecture decisions" -l 20 --compact > search-results.txt# Use in a pipeline — find relevant tickets and open the first one
indexed index search "auth timeout" -c eng-tickets --compact \
| head -1 \
| awk '{print $2}'