If you are seeing that the status of your Collections are frequently changing from Synchronised to Pending, there are a few reasons this could be happening:
1. Scheduled Collections updates
Periodic reindex operations are performed to ensure that collections remain up-to-date. They help maintain the accuracy of your collections by synchronising them with the latest changes in your index, ensuring that any new or modified records are reflected in your collections.
The status of Collections will change to Pending during this process.
2. Creating/editing multiple Collections in a row
When you create or edit a Collection a reindex is triggered. If a previous reindex is in progress, existing Collections can fall into a Pending state while this waits to complete. This will be corrected at the next scheduled reindex which happens every 2 hours.
3. Changes to your data not going through either withTransformation methods or the Ingestion API pushTask method
To keep your Collections up to date, you will need to update your code to ensure Collections work as intended, with either withTransformation methods or use the Ingestion API pushTask method so that your updates go through the Ingestion pipeline and preserve your collection data. If your updates are not sent through this method, your Collections status can change to Pending. This is reconciled at the next scheduled Collections reindex, or by manually saving the Collection on the Algolia Dashboard.
For conditional collections, they can get stuck in pending if the entire record is not sent to the push endpoint. When updating your records (for example with PartialUpdateObjectsWithTransformation method), you need to ensure that you include all attributes referenced in the Collections' conditions in the payload of the update request.
4. Dynamically creating collections based on an unretrievable attribute
Collections reindexes are evaluated using methods where settings in unretrievableAttributes are applied. If the attribute that the Collection is filtered on is not retrievable, then the Collection can’t be evaluated and will fall into a Pending state.
5. Manually added records to the Collection, no longer exist in the index
In the setup where individual items are selected manually for your collection, a Collection can fall into a pending state if one or more of the manually selected items is no longer present in the index (for example, the record was removed). To resynchronise the Collection, you’ll need to remove the missing items from the Collection (or re-add those records to the index).
For more on this please take a look at this doc:Ensure Collections remain up-to-date.
If you feel that one of the above reasons does not explain the behaviour you are seeing, then please contact the Support Team.