Hey all, I'm trying to install the typesense exten...
# random
d
Hey all, I'm trying to install the typesense extension on a firebase collection where each document has some nested fields, but I want to index only a few of these nested fields with each typesense record. • Data doesn't sync with typesense when I add
field1.nestedField1
in the
Firestore Collection Fields
input when configuring the extension. • Data does sync with typesense if I only put
field1
in the same input, but then my typesense schema appears to auto-update to include every nested field within
field1
Should I be able to target nested fields in
Firestore Collection Fields
with dot notation? If so, should each value that I provide to
Firestore Collection Fields
correlate with a field item in my typesense schema? And is the schema supposed to auto-update after I connect typesense to my firebase collection? I'm not finding much information online about how to properly configure the firebase extension to work with nested fields, but I know that's a fairly new feature. Thanks in advance.
j
@David Engel The extension doesn’t allow you to send a subset of fields from a nested object into Typesense. It only allows syncing top-level keys/values fully.
In the Typesense Schema though, you could choose to only index a subset of fields within the nested object. Only those fields will be stored in memory and the other fields will be stored on disk and returned when the document is a hit
d
Okay, makes sense. So in
Firestore Collection Fields
I should specify
field1
, and then in my schema I need to provide info for
field1
, as well as all relevant nested fields I want to index, like:
Copy code
"fields":[
    {
      "name": "field1",
      "type": "object"
    },
    {
      "name": "field1.nested1",
      "type": "object[]"
    },
    {
      "name": "field1.nested1.nested2",
      "type": "string[]"
    },
    {
      "name": "field1.nested1.nested3",
      "type": "object[]"
    },
    {
      "name": "field1.nested1.nested3.nested4",
      "type": "string[]"
    },
    {
      "name": "field1.nested1.nested3.nested5",
      "type": "string[]"
    }
]
But then when I do connect to firestore and begin syncing data to typesense, my schema in
collection settings
increases in length by abouce 4x, to include every other nested field in
field1
... You're saying this is also expected?
j
You’d only need to mention the “leaf” level node
👍 1
So if you only need to index
field1.nested1.nested3.nested5
, you can skip the other items in your example, from the schema
👍 1
Adding this is what causes the more specific field definitions to be ignored.
Copy code
{
      "name": "field1",
      "type": "object"
    },
Essentially the more generic field definitions take precedence if they’re specified, so you want to take those out and leave the most specific one(s)
d
Oh okay, that's good to know. Thanks for the additional info, much appreciated 🙏
👍 1
I'm still not getting any data when I try to index
field1.nested1.nested2
which looks like
Copy code
field1: {
  nested1: [ ... { nested2: <value> } ]
}
and I see
Copy code
Error: Request failed with HTTP code 404 | Server said: Field field1.nested1.nested2 not found.
in the firebase logs
j
Oh hmm, I thought we addressed that, looks like it got lost in the mix in that thread. Mind creating a separate issue for it, so we can track it?
👍 1