How to delete multiple documents in Azure Cosmos DB - azure

On Azure Cosmos DB portal, Data Explorer doesn't allow deletion of more than one document.
Is it possible to delete multiple documents in one go?

You cannot delete multiple documents, but you can use stored procedure to delete documents in one partition.
Please refer to this Q&A set for information on that: Azure CosmosDB: stored procedure delete documents based on query

No, you can't delete multiple documents in one go. Each document must be deleted separately.
One possible solution would be to write a stored procedure and pass the list of document ids that you want to delete. In that stored procedure, you can loop through that list and delete individual documents.

Related

Track Deletion with combined index Azure Cognitive Search

I have a combined index that crawls data from Azure SQL and Blob and are mapped based a common column.
The mapped blob document is optional.
When there is no blob document the search indexer indexes the respective SQL row setting the content propertyas null and if the document is available the content property shows correct data.
I have enabled BLOB deletion tracking and the issue comes when a blob document is deleted. The deletion policy triggers and also removes the mapped SQL row values from index.
I was expecting that the content property will be set to null, but the deletion policy also removes the mapped SQL row values from index.
What am I doing wrong? Kindly help.
Thanks a lot in advance..
BR
The behavior you are seeing is by default. SQL Deletion Policy deletes full index documents based on their document Key, not specific fields. The policy doesn't have a way to know the index has values from other sources too. If there is a combined index and you would like the behavior you are looking for, you may try instead using a Logic App SQL trigger to update only specific fields with Add, update or delete documents, instead of the Deletion Policy.

How can delete azure search old document and add new document which is refreshed recently in indexer?

I have created a azure search service and trying to import data using azure SQL data source and I have scheduled it to refresh the data. Data is getting refreshed properly in data source as I can verify it through indexer and index. However, in index it's getting added every time with initial document but I want only newly/updated documents in index for example if initial no. of document in index was 150 then after refresh it's increases to 156 but I want only 6 document their after refresh.
I tried both option high watermark and soft delete.
Azure Search is designed to incrementally add new documents automatically. So you could delete documents first and then upload documents.
However, delete document you need to specify field in document, currently there's no way to delete all the documents from an index. As you suspected deleting and re-creating the index is the way to go. Also you could vote up this feedback.
If you still want the feature that remove the initial document you could add an item to our userVoice page.

Query to update a table contents in azure table storage

Is it possible to update a column using Query in azure table storage ? The table has already 100 records and now I have added a new column. For the previous 100 records , the newly added column value is "null" as shown in the image. I just want to set a default value for all the 100 records. I need to know how to update the table.
There are several ways to edit columns in Azure storage, you can use the Update Entity functionality to do via Web requests, I'd recommend checking the documentation, Then you can also use Storage Explorer to modify single columns if you have enough permissions.

How to automatically update data source and index for a view in Azure Search

How can I update the exiting data source which is create from azure SQL view.
What are steps I need to follow once when dealing with azure search for Database view.
My Data source& index should be updated once my view gets updates.
Assuming that by "updating the view" you mean adding more columns to the SELECT clause:
You don't need to update the datasource as long as you didn't change the name of the view or the credentials.
You will need to add newly added fields to your index definition. This doesn't happen automatically. Once you add new fields to your index schema, indexer will start populating those fields for newly indexed rows. To populate documents that have already been indexed, reset the indexer (in the portal or using the Reset Indexer API).

Deleting queried documents from Azure's CosmosDB

I have a collection in CosmosDB that has a large number of JSON files. I have a python program that continuously writes and uploads data to that collection. My format of the data just changed, so I am now writing files with a new structure. I have to delete all the files in my collection with the old structure.
Question 1: Do the documents have a date of creation tag? If so, I would like to delete all the files that have a date of creation earlier than a specific date. How can I do that?
Question 2: If the answer to the previous question is no, there is a way I can query parts inside all the old files I want to delete. I cannot query the files entirely, but I can query what's inside of them. So is there a way to delete the entire documents based on the query of what's inside of them? Maybe if there is a way to retrieve all the document IDs that are used to respond to my query, then it would be possible.
All documents have a property called _ts which is the unix timestamp of when the document was created and is auto populated by Cosmos. You should be able to query using this property to find all the documents created before a specific date.

Resources