Skip to content

Instantly share code, notes, and snippets.

@alexkappa
Forked from jasonbosco/typesense-repro-steps.sh
Last active August 7, 2025 12:24
Show Gist options
  • Select an option

  • Save alexkappa/c649f559ba9b60cd9713ec3177f8004e to your computer and use it in GitHub Desktop.

Select an option

Save alexkappa/c649f559ba9b60cd9713ec3177f8004e to your computer and use it in GitHub Desktop.
Quick set of curl commands to help reproduce any issues with Typesense
### Run Typesense via Docker ########################################
set -x
export TYPESENSE_API_KEY=xyz
export TYPESENSE_HOST=http://localhost:8108
docker stop typesense-repro 2>/dev/null
docker rm typesense-repro 2>/dev/null
rm -rf "$(pwd)"/typesense-data-dir-repro
mkdir "$(pwd)"/typesense-data-dir-repro
# Wait for Typesense to be ready
docker run -d -p 8108:8108 --name typesense-repro \
-v"$(pwd)"/typesense-data-dir-repro:/data \
typesense/typesense:29.0 \
--data-dir /data \
--api-key=$TYPESENSE_API_KEY \
--enable-cors
# Wait till typesense is ready.
until curl -s -o /dev/null -w "%{http_code}" "$TYPESENSE_HOST/health" -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" | grep -q "200"; do
sleep 2
done
curl -s "$TYPESENSE_HOST/debug" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" | jq
curl -s "$TYPESENSE_HOST/collections" \
-X POST \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '
{
"name": "users",
"fields": [
{"name": "email", "type": "string", "facet": true, "optional": true, "token_separators": [ ".", "-", "_", "@"]}
],
"token_separators": [".", "-", "_"]
}' | jq
curl -s "$TYPESENSE_HOST/collections/users/documents/import?action=create" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: text/plain" \
-X POST \
-d '{"id":"124", "email":"[email protected]"}
{"id":"125", "email":"[email protected]"}
{"id":"125", "email":"[email protected]"}' | jq
curl -s "$TYPESENSE_HOST/multi_search" \
-X POST \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '
{
"searches": [
{
"collection": "users",
"q": "example",
"query_by": "email"
}
]
}' | jq
docker stop typesense-repro
docker rm typesense-repro
### Documentation ######################################################################################
# Visit the API reference section: https://typesense.org/docs/28.0/api/collections.html
# Click on the "Shell" tab under each API resource's docs, to get shell commands for other API endpoints
@alexkappa
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment