Issues with Indexing Data using Typesense in Go
TLDR Konrad was having trouble with a "Forbidden" error using Typesense in Go when indexing data remotely. David offered multiple troubleshooting steps and suggestions. Ultimately, Konrad discovered the issue lied within the application code.
Sep 03, 2023 (3 months ago)
Konrad
08:09 PMAny ideas how to solve this or figure out what's wrong?
Konrad
08:12 PMKonrad
08:18 PMKonrad
08:19 PMDavid
08:32 PMDavid
08:36 PM{"message": "Forbidden - a valid
x-typesense-api-key header must be sent."}
Konrad
08:37 PMKonrad
08:38 PM _, err = typesenseClient.Collection("tasks").
Documents().
Import(typesenseTasks, &api.ImportDocumentsParams{
Action: pointer.String("upsert"),
BatchSize: (100),
})
Konrad
08:38 PMDavid
08:39 PMKonrad
08:40 PMKonrad
08:40 PMKonrad
08:40 PMKonrad
08:41 PMDavid
08:42 PMDavid
08:43 PMDavid
08:43 PMpointer.String("upsert")
David
08:44 PMDavid
08:46 PMDavid
08:46 PMAction: "upsert"
insteadKonrad
08:48 PM*string
(not string
) in the params structKonrad
08:49 PMDavid
08:52 PMDavid
08:53 PMDavid
08:55 PMDavid
08:56 PMcurl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X POST --data-binary @documents.jsonl \
''
Konrad
08:57 PMDavid
08:57 PMDavid
08:57 PMjq -c '.[]' documents.json > documents.jsonl
Konrad
09:01 PMDavid
09:01 PMDavid
09:01 PMDavid
09:01 PMparams := &api.ImportDocumentsParams{Action: pointer.String("create")}
responses, err := typesenseClient.Collection(collectionName).Documents().Import(documents, params)
Konrad
09:01 PMDavid
09:02 PM_, err =
should that be
_, err :=
?Konrad
09:02 PMerr
is already defined in my caseKonrad
09:03 PM:=
defines a new variable on the fly but it will give you a compile error when you try to redeclare an existing variableDavid
09:07 PMDavid
09:09 PMDavid
09:09 PMDavid
09:09 PMKonrad
09:10 PMDavid
09:11 PMKonrad
09:11 PMSep 04, 2023 (3 months ago)
Konrad
08:36 AMKonrad
08:36 AMKonrad
09:13 AMTypesense
Indexed 3015 threads (79% resolved)
Similar Threads
Issues with Importing Typesense Collection to Different Server
Kevin had problems migrating a Typesense collection between Docusaurus sites on different machines. Jason advised them on JSONL format, handling server hosting, and creating a collection schema before importing documents, leading to successful import.
Typesense Server Bulk Import/Upsert Issue Resolved
Adam was confused about the discrepancy between the successful responses and the actual indexed data while working with a custom WP plugin integrating with Typesense. The issue was a bug related to fetching documents in the wrong order, not a Typesense problem.
Troubleshooting Indexing Duration in Typesense Import
Alan asked about lengthy indexing times for importing documents to Typesense. Jason suggested various potential causes, including network connectivity and system resources. They later identified the problem to be an error in Alan's code.
Resolving Issues with Scoped API Keys in Typesense with Golang
Suvarna had problems with generating and using scoped API keys in Typesense with Golang. Several bugs misleading the user were found and fixed by Kishore Nallan.
Troubleshooting Typesense Document Import Error
Christopher had trouble importing 2.1M documents into Typesense due to memory errors. Jason clarified the system requirements, explaining the correlation between RAM and dataset size, and ways to tackle the issue. They both also discussed database-like query options.