he build-index¶
Build or rebuild the vector search index for a knowledge abstract.
Synopsis¶
Arguments¶
| Argument | Description |
|---|---|
KA_PATH |
Path to knowledge abstract directory |
Options¶
| Option | Short | Description |
|---|---|---|
--force |
-f |
Force rebuild even if index exists |
Description¶
Builds a vector search index for semantic search and chat functionality:
- Reads all entities/relations — From the knowledge abstract data
- Generates embeddings — Using the configured embedding model
- Builds FAISS index — For fast similarity search
- Saves to disk — In the
index/subdirectory
Required for: he search and he talk commands.
Examples¶
Build Index¶
Output:
Template: general/biography_graph
Language: en
Success! Index built for ./output/
Now you can:
he search ./output/ "keyword" # Semantic search
he talk ./output/ -i # Interactive chat
Force Rebuild¶
If the index is corrupted or you want to rebuild:
When to Build Index¶
After Parse (Default)¶
By default, he parse builds the index automatically:
Skip with --no-index if you don't need search/chat:
After Feed¶
Always rebuild after feeding new documents:
After Manual Changes¶
If you modify data.json manually:
Index Storage¶
The index is stored in the knowledge abstract directory:
./ka/
├── data.json
├── metadata.json
└── index/ # Index directory
├── index.faiss # FAISS vector index
└── docstore.json # Document store mapping
Performance¶
Build Time¶
| Knowledge Abstract Size | Approximate Build Time |
|---|---|
| Small (< 100 items) | < 5 seconds |
| Medium (100-1000) | 5-30 seconds |
| Large (1000+) | 30+ seconds |
Search Speed¶
Once built, searches are fast:
Best Practices¶
- Build after feeding — Index becomes stale after
he feed - Use
--no-indexfor batch — Build once after all parsing - Force rebuild if issues — Use
-fif search returns unexpected results - Backup large indices — The
index/directory can be large
Batch Workflow¶
For processing multiple documents efficiently:
# Parse all without building index
he parse doc1.md -t general/biography_graph -o ./ka/ -l en --no-index
he feed ./ka/ doc2.md
he feed ./ka/ doc3.md
# Build index once at the end
he build-index ./ka/
# Now ready for search/chat
he search ./ka/ "query"
he talk ./ka/ -q "question"
Troubleshooting¶
"Index already exists"¶
Use -f to force rebuild:
"Failed to build index"¶
Check:
1. Knowledge base has data: he info ./ka/
2. API key is configured: he config show
3. Sufficient disk space for index
Search still doesn't work¶
Try force rebuild: