How can I configure Azure Cognitive Search to detect and process deletions based on nested properties within a Cosmosdb document?
Description of the problem:
I'm currently integrating Azure Cognitive Search with a Cosmos DB collection that contains complex, nested documents like this:
{
"name":"test name",
"info":{
"address":"test address",
"isIndexing":"false"}
}
I want to synchronize the search index so that deletions based on the document's "isIndexing" property are reflected. What I want to do is use the Data Deletion Detection Policy of Azure Cognitive Search, and for this reason, I created it like this:
"dataDeletionDetectionPolicy" : {
"@odata.type": "#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy",
"softDeleteColumnName": "info.isIndexing",
"softDeleteMarkerValue": "true"
}
so that the document should be deleted from the index if "isIndexing" property is true but this works properly if the "isIndexing" property is in the top level of the object, like here
{
"name":"test name",
"isIndexing":"false"
"info":{
"address":"test address"
}
}
and the policy will be like that
"dataDeletionDetectionPolicy": {
"@odata.type": "#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy",
"softDeleteColumnName": "isIndexing",
"softDeleteMarkerValue": "true"
}
But I don't want to change the structure of the document in Cosmosdb, and I don't know if the deletion detection policy does not support dot notation for nested properties. This might be the reason the policy isn't working as expected, or Azure Cognitive Search's soft delete feature does not inherently support nested properties directly.
The soft delete functionality is designed to work with a single column for marking deletions.
Instead of relying on the soft delete feature, implement custom logic in your Azure Function to detect deletions based on the nested
isIndexingproperty within the Cosmos DB documents.isIndexingproperty.We will see informational logs when a document is marked as deleted in Azure Cognitive Search.