Gabriel Marinho
02/05/2025, 10:46 PMjoin_collection
schema references source_collection
using the source_id
field
My request is something like this in source_collection:
filter_by: id:* || $join_collection(id:*)
include_fields: $join_collection(*)
So basically this request works fine for the multisearch endpoint, but the export just keeps running until it times out, and all the subsequent requests fails with 503 for some seconds.
I suspect that this is breaking because not all documents in source_collection are referenced in join_collection. Multisearch handles this by doesn't showing the joined document, but the export just crashes.Jason Bosco
02/05/2025, 11:05 PMv28.0.rc36
? This sound similar to an issue we fixed recentlyGabriel Marinho
02/05/2025, 11:14 PMJason Bosco
02/05/2025, 11:15 PMGabriel Marinho
02/05/2025, 11:15 PMGabriel Marinho
02/06/2025, 12:11 AMJason Bosco
02/06/2025, 12:36 AMGabriel Marinho
02/06/2025, 12:37 AM### Run Typesense via Docker ########################################
export TYPESENSE_API_KEY=xyz
mkdir "$(pwd)"/typesense-data
docker run -p 8108:8108 \
-v"$(pwd)"/typesense-data:/data typesense/typesense:27.1 \
--data-dir /data \
--api-key=$TYPESENSE_API_KEY \
--enable-cors
### Reproduction Steps ###############################################
export TYPESENSE_API_KEY=xyz
curl "<http://localhost:8108/debug>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}"
curl "<http://localhost:8108/collections>" \
-X POST \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '{
"name": "redemption_codes",
"fields": [
{"name": "code", "type": "string" },
{"name": "created_at", "type": "int64" }
]
}'
curl "<http://localhost:8108/collections>" \
-X POST \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '{
"name": "transactions",
"fields": [
{"name": "redemption_code", "type": "string", "reference": "redemption_codes.code", "optional": true },
{"name": "amount", "type": "int64" },
{"name": "created_at", "type": "int64" }
]
}'
curl "<http://localhost:8108/collections/redemption_codes/documents/import?action=create>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: text/plain" \
-X POST \
-d '{"id": "124","code": "1234","created_at": 12345678 }
{"id": "125","code": "5678","created_at": 12345678 }'
curl "<http://localhost:8108/collections/transactions/documents/import?action=create>" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-H "Content-Type: text/plain" \
-X POST \
-d '{"id": "124","redemption_code": "1234","amount": 100,"created_at": 12345678 }
{"id": "125","amount": 200,"created_at": 12345678 }' # note that this transaction does not have a redemption code
echo $"\n\nTrying to multi search\n"
curl "<http://localhost:8108/multi_search>" \
-X POST \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
-d '{
"searches": [
{
"q": "*",
"collection": "redemption_codes",
"filter_by": "id:* || $transactions(id:*)",
"include_fields": "$transactions(*)"
}
]
}'
echo $"\n\nTrying to export\n"
curl "<http://localhost:8108/collections/redemption_codes/documents/export?filter_by=id:*%20%7C%7C%20$transactions(id:*)&include_fields=$transactions(*)>" \
-X GET \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
Jason Bosco
02/06/2025, 12:38 AMHarpreet Sangar
02/06/2025, 4:16 PMcurl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X GET \
"<http://localhost:8108/collections/redemption_codes/documents/export?filter_by=id%3A%2A%20%7C%7C%20%24transactions%28id%3A%2A%29&include_fields=%24transactions%28%2A%29>"
returns
{"code":"1234","created_at":12345678,"id":"124","transactions":{"amount":100,"created_at":12345678,"id":"124","redemption_code":"1234"}}
{"code":"5678","created_at":12345678,"id":"125"}
Harpreet Sangar
02/06/2025, 4:17 PMSo basically this request works fine for the multisearch endpoint, but the export just keeps running until it times out, and all the subsequent requests fails with 503 for some seconds.Still, this shouldn't happen.
Gabriel Marinho
02/06/2025, 7:27 PMHarpreet Sangar
02/07/2025, 4:27 AMGabriel Marinho
02/07/2025, 3:19 PMHarpreet Sangar
02/11/2025, 12:35 PMasync_reference: true
in your reference field definition if you can't control the order of the insertion.Gabriel Marinho
02/11/2025, 12:44 PMHarpreet Sangar
02/11/2025, 12:46 PMGabriel Marinho
02/11/2025, 12:48 PMHarpreet Sangar
02/11/2025, 12:48 PMasync_reference: true
property, you'll have to reindex your collection since we don't yet support altering the reference
field.Gabriel Marinho
02/11/2025, 12:49 PMGabriel Marinho
02/11/2025, 2:09 PMHarpreet Sangar
02/11/2025, 2:10 PMHarpreet Sangar
02/11/2025, 2:14 PMredemption_code
should look like this
{
"name": "redemption_code",
"type": "string",
"reference": "redemption_codes.code",
"optional": true,
"async_reference": true
}
Gabriel Marinho
02/11/2025, 2:16 PMGabriel Marinho
02/17/2025, 6:39 PMHarpreet Sangar
02/18/2025, 1:21 AMGabriel Marinho
02/18/2025, 2:50 PM- q:*
- filter_by: id:* || rockitcoin_transactions_kiosk(id:*)
- include_fields: $rockitcoin_transactions_kiosk(id)
Gabriel Marinho
02/18/2025, 2:50 PMHarpreet Sangar
02/20/2025, 6:26 AMHarpreet Sangar
02/20/2025, 6:26 AMGabriel Marinho
02/20/2025, 2:22 PMHarpreet Sangar
02/20/2025, 2:24 PMHarpreet Sangar
02/20/2025, 2:36 PMGabriel Marinho
02/20/2025, 2:52 PMconst res = await typesenseClient.collections("rockitcoin_transactions_kiosk").documents().export({ filter_by: "id:* || $rockitcoin_transactions_kiosk(id:*)", include_fields: "$rockitcoin_transactions_kiosk(id) });
Gabriel Marinho
02/20/2025, 2:53 PMHarpreet Sangar
02/23/2025, 6:07 AMconst res = await typesenseClient.collections("rockitcoin_transactions_kiosk").documents().export({ filter_by: "id:* || $rockitcoin_transactions_kiosk(id:*)", include_fields: "$rockitcoin_transactions_kiosk(id) as transaction });
will work as expected now.Gabriel Marinho
02/24/2025, 12:59 PMGabriel Marinho
02/24/2025, 1:00 PMHarpreet Sangar
02/24/2025, 1:23 PMHarpreet Sangar
02/24/2025, 1:26 PMKishore Nallan
02/24/2025, 1:30 PMGabriel Marinho
02/24/2025, 1:35 PMKishore Nallan
02/24/2025, 4:36 PM29.0.rc2
Gabriel Marinho
02/25/2025, 6:38 PM