Getting Started
The Typesense block (typesense-typesense) on Liivo Cloud runs Typesense, an open source, typo-tolerant search engine with an HTTP API. You index JSON documents into collections and query them with filtering, faceting, grouping, geo search, synonyms, and vector and hybrid search. Each instance is a single node with persistent storage.
Prerequisites
- A Liivo Cloud account and workspace.
- A long random string to use as the admin API key.
Step 1: Store the admin API key as a secret
Store the key as a service secret so it is not kept in clear in the instance parameters. Name it, for example, typesensekey, and reference it as {{secrets.typesensekey}}. The secret reference must be the entire value of the field.
Step 2: Create a Typesense instance
Create an instance of the Typesense block with these options:
{
"name": "mysearch",
"ApiKey": "{{secrets.typesensekey}}"
}
Wait until the instance is running. The instance URL looks like https://<tenant>-mysearch.typesense-typesense.auto.prod-se.osaas.io.
Usage Example
Every request must send the admin key in the X-TYPESENSE-API-KEY header. A request without a valid key gets 401.
URL=https://<tenant>-mysearch.typesense-typesense.auto.prod-se.osaas.io
KEY=<your-api-key>
# Health (no key needed)
curl $URL/health
# Create a collection
curl -X POST $URL/collections \
-H "X-TYPESENSE-API-KEY: $KEY" -H 'Content-Type: application/json' \
-d '{"name":"articles","fields":[{"name":"title","type":"string"}]}'
# Add a document
curl -X POST $URL/collections/articles/documents \
-H "X-TYPESENSE-API-KEY: $KEY" -H 'Content-Type: application/json' \
-d '{"title":"Hello Liivo Cloud"}'
# Search
curl "$URL/collections/articles/documents/search?q=hello&query_by=title" \
-H "X-TYPESENSE-API-KEY: $KEY"
Use any official Typesense client library (JavaScript, Python, PHP, Ruby and others) with the instance host, port 443, protocol https and your key.
For a website or app that searches directly from the browser, do not ship the admin key. Create a search-only key with the Typesense API keys endpoint and use that in the browser.
Configuration
| Option | Required | Description |
|---|---|---|
| name | Yes | Name of the instance. |
| ApiKey | Yes | Admin API key (stored as a secret). Every request must send it in the X-TYPESENSE-API-KEY header. The instance does not start without it. |
| EnableCors | No | Whether browsers on other origins may call the API directly. On by default. |
| CorsDomains | No | Comma-separated origins allowed when CORS is on, for example https://www.example.com. All origins are allowed when empty. |
Limitations
- The API is reachable without the Liivo Cloud sign-in gate: the API key is the only protection. Use a long random key and keep it secret.
- Single node only. Clustering is not available.
- Data lives on one persistent volume of 10 GB, mounted at
/data. Typesense keeps its index in memory, so size your data against the instance memory (1536 MiB by default). - Tested: instance start, key enforcement, creating a collection, indexing and searching a document, data surviving a restart, and CORS behavior.
- Not tested: search-only and scoped keys, vector and semantic search, large data sets, backups and snapshots, and behavior when the volume fills up.
Resources
- Typesense documentation
- Typesense source code (GPL-3.0)