#community-help

Specific Collection Backfill and Schema Config in Firebase Extension

TLDR Loic asked Jason about backfilling specific collections with the Firebase Extension and configuring collection schemas. The latter explained current limitations and gave advices about handling attributes for search/filtering, storage, and return.

Powered by Struct AI
17
18mo
Solved
Join the chat
Apr 27, 2022 (18 months ago)
Loic
Photo of md5-3a88a602e4aba6a18b4a6c6985fcf08c
Loic
05:58 PM
Jason Hi Jason,
With the Firebase Extension (https://github.com/typesense/firestore-typesense-search#step-3%EF%B8%8F%E2%83%A3--optional-backfill-existing-data) can we backfill a specific collection and not all at once?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:20 PM
Ah hmm, not at the moment unfortunately. Could you open an issue on Github in that repo with this feature request?
Loic
Photo of md5-3a88a602e4aba6a18b4a6c6985fcf08c
Loic
06:24 PM
Just did 👍
06:30
Loic
06:30 PM
Jason Also in new collection schema, it automatically ignore my field id

"fields": [
      {
        "name": "id",
        "type": "string",
        "index": true
      },
…

Is this an expected behavior? :thinking_face:
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:30 PM
Yes this is expected. If you want to search by the ID field, you want to duplicate that in a new field
Loic
Photo of md5-3a88a602e4aba6a18b4a6c6985fcf08c
Loic
06:31 PM
OK, thank you 👍
06:50
Loic
06:50 PM
I please need your advice on the collection schema

If I know that I will query by FieldA but never by FieldB , what should be the difference in


"fields": [
      {
        "name": "FieldA",
        "type": "string",
        "index": true
      },{
        "name": "FieldB",
        "type": "string",
        "index": true
      },
…
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:50 PM
You can just leave FieldB out of the schema
06:51
Jason
06:51 PM
Only fields you want to search / filter / facet / sort need to be part of the schema
Loic
Photo of md5-3a88a602e4aba6a18b4a6c6985fcf08c
Loic
06:51 PM
When I tried this I didn’t receive the field from Firestore :thinking_face:
06:51
Loic
06:51 PM
Because I still want to store and return in my search the FieldB
06:51
Loic
06:51 PM
But not use it to query
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:52 PM
All other fields can still be part of your document, they'll be stored on disk and returned in results
06:52
Jason
06:52 PM
> When I tried this I didn’t receive the field from Firestore
If you want to sync all fields over from Firestore, you want to leave the fields configuration in the extension blank
Loic
Photo of md5-3a88a602e4aba6a18b4a6c6985fcf08c
Loic
06:53 PM
In firestore I have FieldA , FieldB and FieldC

I would like to have in typesense FieldA & FieldB stored
Query by FieldA only and return FieldA & FieldB in the results
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:54 PM
Got it, then in the Firebase Extension configuration, you want to mention FieldA,FieldB in the list of fields.

Then in Typesense, only add FieldA to the schema
Loic
Photo of md5-3a88a602e4aba6a18b4a6c6985fcf08c
Loic
06:55 PM
👍 Perfect I will try it out