Kirill Razumovskiy
07/30/2024, 6:34 AM# Create a collection
curl -X POST "<http://localhost:8108/collections>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "test",
"fields": [
{
"name": "text_stem",
"type": "string",
"stem": true
},
{
"name": "text",
"type": "string"
}
]
}'
# Add a document to the collection
curl -X POST "<http://localhost:8108/collections/test/documents>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"id": "1",
"text": "subscription",
"text_stem": "subscription"
}'
# Perform a multi-search
curl -X POST "<http://localhost:8108/multi_search>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"searches": [
{
"q": "subscription",
"collection": "test",
"query_by": "text_stem"
},
{
"q": "subscription",
"collection": "test",
"query_by": "text,text_stem"
}
]
}'