Overview
I looked into how to bulk delete content in Drupal, so this is a memo. The following article was helpful.
https://www.webwash.net/how-to-bulk-delete-content-in-drupal/
The following three methods were introduced.
- Using Drupal Core UI
- Using Drush
- Using Drupal Views Bulk Operations (VBO)
Using Drupal Core UI
The following is a translation of the original description.
If you have a small Drupal site and fewer than about 300 nodes to delete, you should use this method. This is because the Drupal Core UI only allows deleting 50 nodes at a time by default. As the site grows larger, this becomes tedious.
Using Drush
The following is a translation of the original description.
If you can use the command line, you can use Drush. This is the recommended method.
For example, the following deletes all nodes of the article content type.
However, as mentioned on the above site, it may hit the PHP memory limit. When I attempted to bulk delete 5,000 items in a 512MB memory environment on Amazon Lightsail, it hit the limit as shown below. However, running the same command again successfully completed the bulk deletion.
Specify the Chunk/Batch Size
By default, items are processed 50 at a time, but the batch size can be changed by adding an argument like –chunks=100.
Using Views Bulk Operations (VBO)
It appears that the following module is used. I did not try it this time, but I would like to try it eventually.
https://www.drupal.org/project/views_bulk_operations
Summary
As might be expected, the bulk deletion operation also deleted the items on Elasticsearch (specifically, Amazon OpenSearch Service) connected via the “Elasticsearch Connector.”
I found it convenient to have functionality like Drush available, compared to other CMS platforms such as Omeka.