Mirko Nitschke
12/08/2025, 3:00 PMAlan Martini
12/08/2025, 3:24 PMMirko Nitschke
12/08/2025, 6:58 PMfoo.bar+test@test-foobar.com
If I have token-separators [".","+","@","-"]
and `symbols_to_index as the same
it will create the following tokens:
foo.bar+test@test-foobar.com
foo, bar, test ,foobar,com ?
Or also all combinations? 🤔Mirko Nitschke
12/09/2025, 3:27 PMAlan Martini
12/09/2025, 3:28 PMMirko Nitschke
12/10/2025, 12:20 PM### 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.rc31 \
--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": "companies",
"fields": [
{"name": "company_name", "type": "string" },
{"name": "num_employees", "type": "int32" },
{"name": "country", "type": "string", "facet": true },
{"name": "email", "type": "string", "token_separators": [".","+","@","-"], "symbols_to_index": [".","+","@","-"]}
],
"default_sorting_field": "num_employees"
}' | jq
curl -s "$TYPESENSE_HOST/collections/companies/documents/import?action=create" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: text/plain" \
-X POST \
-d '{"id": "124","company_name": "Stark Industries","num_employees": 5215,"country": "USA", "email": "foo.bar+test@test-foobar.com"}
{"id": "125","company_name": "Acme Corp","num_employees": 2133,"country": "CA", "email": "foo.bar2+test@test-foobar.com"}' | 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": "companies",
"q": "foo.bar+test@test-foobar.com",
"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 endpointsMirko Nitschke
12/10/2025, 12:21 PM+ curl -s -o /dev/null -w '%{http_code}' http://localhost:8108/health -H 'X-TYPESENSE-API-KEY: xyz'
+ grep -q 200
+ sleep 2
+ curl -s -o /dev/null -w '%{http_code}' http://localhost:8108/health -H 'X-TYPESENSE-API-KEY: xyz'
+ grep -q 200
+ sleep 2
+ curl -s -o /dev/null -w '%{http_code}' http://localhost:8108/health -H 'X-TYPESENSE-API-KEY: xyz'
+ grep -q 200
+ curl -s http://localhost:8108/debug -H 'X-TYPESENSE-API-KEY: xyz'
+ jq
{
"state": 1,
"version": "29.0.rc31"
}
+ curl -s http://localhost:8108/collections -X POST -H 'Content-Type: application/json' -H 'X-TYPESENSE-API-KEY: xyz' -d '
{
"name": "companies",
"fields": [
{"name": "company_name", "type": "string" },
{"name": "num_employees", "type": "int32" },
{"name": "country", "type": "string", "facet": true },
{"name": "email", "type": "string", "token_separators": [".","+","@","-"], "symbols_to_index": [".","+","@","-"]}
],
"default_sorting_field": "num_employees"
}'
+ jq
{
"created_at": 1765369216,
"default_sorting_field": "num_employees",
"enable_nested_fields": false,
"fields": [
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "company_name",
"optional": false,
"sort": false,
"stem": false,
"stem_dictionary": "",
"store": true,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "num_employees",
"optional": false,
"sort": true,
"stem": false,
"stem_dictionary": "",
"store": true,
"type": "int32"
},
{
"facet": true,
"index": true,
"infix": false,
"locale": "",
"name": "country",
"optional": false,
"sort": false,
"stem": false,
"stem_dictionary": "",
"store": true,
"type": "string"
},
{
"facet": false,
"index": true,
"infix": false,
"locale": "",
"name": "email",
"optional": false,
"sort": false,
"stem": false,
"stem_dictionary": "",
"store": true,
"symbols_to_index": [
".",
"+",
"@",
"-"
],
"token_separators": [
".",
"+",
"@",
"-"
],
"type": "string"
}
],
"name": "companies",
"num_documents": 0,
"symbols_to_index": [],
"token_separators": []
}
+ curl -s 'http://localhost:8108/collections/companies/documents/import?action=create' -H 'X-TYPESENSE-API-KEY: xyz' -H 'Content-Type: text/plain' -X POST -d '{"id": "124","company_name": "Stark Industries","num_employees": 5215,"country": "USA", "email": "foo.bar+test@test-foobar.com"}
{"id": "125","company_name": "Acme Corp","num_employees": 2133,"country": "CA", "email": "foo.bar2+test@test-foobar.com"}'
+ jq
{
"success": true
}
{
"success": true
}
+ curl -s http://localhost:8108/multi_search -X POST -H 'Content-Type: application/json' -H 'X-TYPESENSE-API-KEY: xyz' -d '
{
"searches": [
{
"collection": "companies",
"q": "foo.bar+test@test-foobar.com",
"query_by": "email"
}
]
}'
+ jq
{
"results": [
{
"facet_counts": [],
"found": 0,
"hits": [],
"out_of": 2,
"page": 1,
"request_params": {
"collection_name": "companies",
"first_q": "foo.bar+test@test-foobar.com",
"per_page": 10,
"q": "foo.bar+test@test-foobar.com"
},
"search_cutoff": false,
"search_time_ms": 0
}
]
}
+ docker stop typesense-repro
typesense-repro
+ docker rm typesense-repro
typesense-reproMirko Nitschke
12/10/2025, 12:21 PMFanis Tharropoulos
12/10/2025, 3:41 PMtoken_separators instead of symbols?
There are some breaking changes for v30 you should first know about, you can check them out here:
https://typesense.org/docs/30.0/api/#what-s-newMirko Nitschke
12/10/2025, 3:44 PMFanis Tharropoulos
12/10/2025, 3:45 PMAlan Martini
12/10/2025, 3:46 PMMirko Nitschke
12/10/2025, 3:46 PMMirko Nitschke
12/10/2025, 3:47 PMFanis Tharropoulos
12/10/2025, 3:49 PMMirko Nitschke
12/10/2025, 3:51 PMFanis Tharropoulos
12/10/2025, 3:51 PM