Troubleshooting Invalid Field Error in Firestore Document Indexing
TLDR Darren receives an error when indexing Firestore documents with empty array in "_grades" field. Jason suggests submitting a bug report and manually setting the schema. The user still experiences issues. Kishore Nallan reproduces the bug, but suggests a solution might exist with an explicit 'string[]' type definition. Further investigation is needed.
1
Dec 22, 2021 (25 months ago)
Darren
05:15 PMThe document (from Firestore) I'm trying to index looks like this:
{
> _location: null,
> description: null,
> label: 'Kindergarten',
> type: 'grade',
> meta: { created: { at: null, by: null }, updated: { at: null, by: null } },
> _grades: [],
> _people: [],
> tenant: 'one',
> collection: 'groups',
> id: 'grade-kindergarten-all'
}
The collection schema is:
{
"created_at": 1640193019,
"default_sorting_field": "",
"fields": [
{
"facet": false,
"index": true,
"name": ".*",
"optional": true,
"type": "auto"
},
{
"facet": false,
"index": true,
"name": "label",
"optional": true,
"type": "string"
}
],
"name": "groups",
"num_documents": 0,
"symbols_to_index": [],
"token_separators": []
... and the error is:
> #push RequestMalformed [Error]: Request failed with HTTP code 400 | Server said: Type of field `_grades` is invalid.
So seems like the
_grades
field (which has avalue of an empty array []
) is causing a problem ... is this expected?Jason
05:16 PMDarren
05:18 PMJason
05:20 PMGET /collections
and share the schema output from there? That should show what grades's auto-detected typeDarren
05:21 PMDarren
05:21 PM"fields": [
{
"facet": false,
"index": true,
"name": ".*",
"optional": true,
"type": "auto"
},
{
"facet": false,
"index": true,
"name": "label",
"optional": true,
"type": "string"
}
],
Darren
05:22 PMJason
05:22 PMJason
05:23 PMDarren
05:23 PMGET /collections/groups
{
"facet_counts": [],
"found": 0,
"hits": [],
"out_of": 0,
"page": 1,
"request_params": {
"collection_name": "groups",
"per_page": 10,
"q": "*"
},
"search_cutoff": false,
"search_time_ms": 0
}
Darren
05:23 PMDarren
05:24 PMJason
05:24 PMJason
05:25 PMDarren
05:29 PMDarren
05:38 PMstring[]
that record still fails. But, when I add a different record FIRST that has data (see below) then after that I can indeed save the record that was failing...here is that record that succeeds first time
> parse {
> _location: null,
> description: null,
> label: 'Grade Eight',
> type: 'grade',
> meta: { created: { at: null, by: null }, updated: { at: null, by: null } },
> _grades: [],
> _people: [
> 'tenants/one/people/eli-schreiber',
> 'tenants/one/people/miriam-schreiber',
> 'tenants/one/people/nathaniel-ewen',
> 'tenants/one/people/talia-ewen',
> 'tenants/one/people/seth-schwartzberg',
> 'tenants/one/people/maya-schwartzberg',
> 'tenants/one/people/michael-meyer',
> 'tenants/one/people/sammi-meyer',
> 'tenants/one/people/jeremiah-engel',
> 'tenants/one/people/ruth-engel',
> 'tenants/one/people/jeremy-maltzman',
> 'tenants/one/people/deborah-maltzman',
> 'tenants/one/people/matt-glaser',
> 'tenants/one/people/chava-glaser',
> 'tenants/one/people/sam-aaronson',
> 'tenants/one/people/chana-aaronson',
> 'tenants/one/people/isaac-feldman',
> 'tenants/one/people/sarah-feldman',
> 'tenants/one/people/josh-feinberg',
> 'tenants/one/people/eve-feinberg'
> ],
> tenant: 'one',
> collection: 'groups',
> id: 'grade-eight-all'
> }
Jason
05:41 PMDarren
05:57 PMJason
07:11 PMDec 23, 2021 (25 months ago)
Kishore Nallan
05:26 AMauto
field. However, with an explicit string[]
type definition, empty values are allowed as the very first document.See here: https://gist.github.com/kishorenc/131476e9fb898381821f8aa026ec3fd0
(I tested this on Typesense 0.22.1)
If you can create a similar snippet for reproduction, it will help. Thanks.
Dec 26, 2021 (25 months ago)
Darren
11:03 PMTypesense
Indexed 3015 threads (79% resolved)
Similar Threads
Cold Start Problem with Dynamic Collections
Adrian reported cold start issues with dynamic collections. Jason suggested using wildcard `*` for query_by parameters, upgrading to `0.25.0.rc34`, and clarified conventions. Adrian's issues were resolved but they reported a limitation that will potentially be addressed.
Issues with Schema Creation and Nested Fields
Sean encountered a problem with schema creation involving auto nested fields. Kishore Nallan suggested checking the API response for errors and adding problematic fields to the schema as optional. Sean confirmed the advice.
Troubleshooting 400 Error When Upgrading Typesense Firestore Extension
Orion experienced a `400` error after updating the Typesense Firestore extension, causing issues with cloud functions. They traced the issue back to a data type conflict in their Typesense collection schema after updating. With help from Jason and Kishore Nallan, they resolved the issue by recreating the collection.
Resolving Error with Incorrect Field Type during Schema Update
Samuel encountered an error updating the schema for an existing collection. Kishore Nallan suggested specifying a concrete type, and later found inconsistent data within the collection that caused the error.
Issue with Embedding Error in Version 0.25.0.rc63
Bill reported a bug in version 0.25.0.rc63 regarding a problem with updating or emplacing a document and receiving an embedding error. This was resolved in version 0.25.0.rc65, but further discussion ensued regarding the function of 'index' in the update feature.