# Cluster Operations
# Create Snapshot (for backups)
Creates a point-in-time snapshot of a Typesense node's state and data in the specified directory.
You can then backup the snapshot directory that gets created and later restore it as a data directory, as needed.
# Sample Response
# Definition
POST ${TYPESENSE_HOST}/operations/snapshot
# Arguments
Parameter | Required | Description |
---|---|---|
snapshot_path | yes | The directory on the server where the snapshot should be saved. |
# Compacting the on-disk database
Typesense uses RocksDB to store your documents on the disk. If you do frequent writes or updates, you could benefit from running a compaction of the underlying RocksDB database. This could reduce the size of the database and decrease read latency.
While the database will not block during this operation, we recommend running it during off-peak hours.
curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X POST http://localhost:8108/operations/db/compact
# Definition
POST ${TYPESENSE_HOST}/operations/db/compact
# Re-elect Leader
Triggers a follower node to initiate the raft voting process, which triggers leader re-election.
The follower node that you run this operation against will become the new leader, once this command succeeds.
# Sample Response
# Definition
POST ${TYPESENSE_HOST}/operations/vote
# Toggle Slow Request Log
Enable logging of requests that take over a defined threshold of time.
Default: -1
which disables slow request logging.
Slow requests are logged to the primary log file, with the prefix SLOW REQUEST
.
# Sample Response
# Definition
POST ${TYPESENSE_HOST}/config
# Clear cache
Responses of search requests that are sent with use_cache
parameter are cached in a LRU cache. To clear
this cache completely:
curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X POST \
http://localhost:8108/operations/cache/clear
# Definition
POST ${TYPESENSE_HOST}/operations/cache/clear
# Cluster Metrics
Get current RAM, CPU, Disk & Network usage metrics.
# Sample Response
# Definition
GET ${TYPESENSE_HOST}/metrics.json
Prometheus Integration
If you use Prometheus, here's a community-maintained project that lets you periodically poll this endpoint and export the data into Prometheus:
https://github.com/imatefx/typesense-prometheus-exporter (opens new window)
# API Stats
Get stats about API endpoints.
This endpoint returns average requests per second and latencies for all requests in the last 10 seconds.
# Sample Response
# Definition
GET ${TYPESENSE_HOST}/stats.json
Prometheus Integration
If you use Prometheus, here's a community-maintained project that lets you periodically poll this endpoint and export the data into Prometheus:
https://github.com/imatefx/typesense-prometheus-exporter (opens new window)
# Health
Get health information about a Typesense node.
# Sample Response
When a node is running out of memory / disk, the API response will have an additional resource_error
field that's
set to either OUT_OF_DISK
or OUT_OF_MEMORY
.
# Definition
GET ${TYPESENSE_HOST}/health
← Stopwords API Errors →