How to handle Firestore 'Reference' types in Algolia? Currently they store sensitive and unnecessary information when imported

Hi,
I’ve just started using Algolia using the new Firestore extension and so far I’m really impressed with the search speed, and the parts of the API I’ve used so far.
I’ve run into a problem with ‘reference’ type fields in Firestore records copied across to Algolia though.

So for context, I have two relevant collections in Firestore - ‘episodes’ and ‘shows’. I’m only indexing episodes on Algolia as the number of shows is small enough that I can just download them all for each user. Each episode has a field called ‘show’, which is a reference type, for example ‘shows/YF7SsCC2KNP88Gcs4wdO’. Now I wasn’t exactly sure what I’d get when importing these to Algolia, but my best guess was it’d just be a string with the path. What you actually get when you import a reference field is a json object that looks something like this:

{
   "_firestore":{
      "_settings":{
         "credentials":{
            "private_key": "an actual SSH key",
            "client_email": "firebase admin service account email"
         },
         "some_other_stuff":""
      }
   },
   "_path":{
      "segments":[
         "shows",
         "YF7SsCC2KNP88Gcs4wdO"
      ]
   },
   "_converter":{}
}

I’ve omitted some fields for brevity, but as you can see it contains super private information (a private SSH key for the firebase admin service account), which totally should not be available in a public search. More broadly, there’s a lot of random information in there wasting space, which actually consitutes more than half the size of the records. The only part I’m actually interested in and that the user should be able to access is _path.segments (it’s okay that it’s an array, possibly better actually).

I am importing the data with npx firestore-algolia-search, and I have this env var $env:FIELDS="title,shortTitle,description,tags,show,timestamp,hidden". I tried to change this to $env:FIELDS="title,shortTitle,description,tags,show._path.segments,timestamp,hidden" but it doesn’t import the relevant field at all.

I also tried setting a custom list of retrieved attributes in the index settings, including show._path.segments but not show, but that doesn’t work either. show._path.segments does work as a facet though!

So what I want to know is - how do we stop this from happening?
Can I:
A) make the reference field value take a different format when importing? (ideal)
B) hide the show field apart from _path.segments, and ideally ‘alias’ show._path.segments if that is possible?

Thanks in advance,
Alex

At this time, we have not implemented processing the Reference Field type and this include dot notation in the Fields configuration. I see you’ve posted an issue here, so you should receive updates about the issue.

As far as the value of the reference, this is out of our control since this is foundational FireStore code. We are using their APIs to get the value of each field type specified.