1
Create a collection
Create a collection that stores your data.
2
Insert initial data
Add documents to your collection.
3
Search your collection
Learn how to use various searching methods:
- Semantic search — finding content by semantic meaning
- Keyword search — finding exact text matches and sorting by keyword score
- Metadata filtering — narrowing down results by document properties
- Reranking (optional) — use built-in reranking to boost relevant results
1. Create your first collection
Collections are the core data structure in TopK. They store documents and provide an interface for querying your data. First, initialize a TopKClient
instance with your API key and
.
Check out the Regions page for more information.
books
collection with a semantic index on the title
field.
semantic_index()
to the title
field enables
semantic search as well as keyword search on this field.
Fields that aren’t defined in the schema can still be upserted.
2. Add documents
After creating a collection, you can start adding documents to it. Documents in TopK are JSON-style dictionaries which must must have an_id
field:
3. Query your collection
Now, run your first semantic search query:.rerank()
at the end of your query to automatically improve relevance of the results using a reranking model. See Reranking guide for more details.