This solution is only applicable if you are deleting all the documents in multiple collections and not for selective deletion:
--------------------------------------------------------------------------------
I had the same scenario, where I needed to delete all the documents in multiple collections. There were close to 500k documents in each shard and there were multiple shards of each collection. Updating and deleting the documents using the query was a big task and thus followed the below process:
1. Used the Solr API for getting the details for all the collections -
```
http://<solrIP>:<port>/solr/admin/collections?action=clusterstatus&wt=json
```
This gives the details like name of collection, numShards, configname, router.field, maxShards, replicationFactor, etc.
2. Saved the output json with the above details in a file for future reference and took the backups of all the collections I needed to delete the documents in, using the following API:
```
http://<solr-ip>:<port>/solr/admin/collections?action=BACKUP&name=myBackupName&collection=myCollectionName&location=/path/to/my/shared/drive
```
3. Further I deleted all the collections which I need to remove all the documents for using the following:
```
http://<solr-ip>:<port>/solr/admin/collections?action=DELETEALIAS&name=collectionname
```
4. Re-created all the collections using the details in the Step 1 and the following API:
```
http://<solr-ip>:<port>/solr/admin/collections?action=CREATE&name=collectionname&numShards=number&replicationFactor=number&maxShardsPerNode=number&collection.configName=configname&router.field=routerfield
```
I executed the above steps in loop for all the collections and was done in seconds for around 100 collections with huge data. Plus, I had the backups as well for all the collections.
Refer to this for other Solr APIs: [DELETEALIAS: Delete a Collection Alias, *Input*](
[To see links please register here]
)