Skip to content

Instantly share code, notes, and snippets.

@kishorenc
Last active June 28, 2023 08:22
Show Gist options
  • Save kishorenc/769bd7606041d5c1e219ba87bdc2a7cd to your computer and use it in GitHub Desktop.
Save kishorenc/769bd7606041d5c1e219ba87bdc2a7cd to your computer and use it in GitHub Desktop.
curl -k "http://localhost:8108/collections" -X POST -H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
"name": "docs",
"fields": [
{"name": "title", "type": "string" }
]
}'
curl "http://localhost:8108/collections/docs/documents" -X POST \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{"title": "Title 1"}'
curl "http://localhost:8108/collections/docs/documents" -X POST \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{"title": "Title 2"}'
# Return 2 hits because providing `per_page` outside is not supported
curl 'http://localhost:8108/multi_search' -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" --data-raw '{
"per_page": 1,
"searches":[
{
"q":"*",
"collection": "docs"
}
]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment