Firestore to Algolia ObjectiD

Hi everyone, I’m quite sure of this at this point but just wanted to confirm. I’m sending my data from Firestore to Algolia via cloud functions. When you create one manually in Algolia without an index Algolia will automatically give it an ObjectID. This doesn’t seem to be the case though when using cloud functions to create records in Algolia (my testing is as far as that I’ve tried to create records without an assigned objectID and it didnt work, i then added one and it did)

Can I ask why this is? My assumption is because that way Firestore already has the unique ID if it needs to go to Algolia and update the record but it may be something else and i just wanted to be aware of it if it was

Thanks all,
Ash

Hey,

the behavior for objectID depends on which method is being called. This is documented in the Indexing part of our documentation.

Basically:

  • when adding a new record (addObject) , Algolia will automatically add an objectID if none is set;
  • when updating a record (updateObject), Algolia will fail if no objectID is set.

I am not familiar enough with Cloud function pipelines however this should clarify what the issue could be. Another possible issue could be that the library is automatically setting an empty objectID so all records would override each other and the index would end up with a single record.

Please let us know if that helps.