I want to remove the "reports" key and its value from the "view" object. I have create a Cloud Function for this. But Algolia not calling this function while indexing documents.
{
"created":1699434507661,
"id":"kHf3oKAOUf",
"uid":"x3VdbQseTcZeNiDezH8Kyj3CKFH3",
"view":{
"material":"DCP",
"reports":[
{
"jrs2GEHYI6pTFtXIrIbc":{
"results":[
{
"title":"Calcium",
"avg_overall":23.5,
"id":"SC2s2IZ8PzhQcNzGb9PH",
"avg_self":23.5,
"unit":"%",
"value":29.11
},
{
"avg_overall":14.25,
"id":"eqpg13ICjsuS53KoyE5I",
"avg_self":14.25,
"unit":"%",
"value":14.39,
"title":"Phosphorus"
}
],
"title":"Calcium & Phosphorus Analysis - (As is)",
"retest":false,
"publish":true,
"file":"AAS-002-2611"
}
}
],
"tests":[
"Calcium & Phosphorus Analysis"
],
},
"updated":1701954794343,
}
This is the Cloud Firestore Transform Function
exports.transform = onRequest((req: any, res: any) => {
const originalDocument = req.body.data;
const transformedDocument = {
// Copy all fields except "reports" within "view"
...originalDocument,
view: {
...(originalDocument.view || {}),
reports: undefined, // Delete "reports" key if present
},
};
res.status(200).send(transformedDocument);
});
Here a Algolia Firebase Extension Config Page Screenshot
I created the cloud function and its working fine in POSTMAN but not working with Algolia Firebase Extension.
