Goal
How can I delete documents based on a query (e.g., matching a field value) rather than specifying individual document IDs?
Environment
Fusion 4.2.6 and Fusion 5.x (Self-Hosted deployments)
Guide
Fusion does not provide a dedicated Fusion API endpoint for deleting documents using query syntax. However, because Fusion uses Solr as the underlying search engine, you can use Solr’s native delete-by-query capability to achieve this.
Use the following curl command to delete documents that match a specified query from a Solr collection:
Example
To delete all documents where the title field contains a value that starts with "foo":
This command sends a JSON payload to the Solr update endpoint for the specified collection. The commit=true parameter ensures that the deletion is immediately committed.
Notes
-
This operation directly accesses the Solr endpoint, so you must know the Solr host and collection name.
-
Query syntax follows Solr's Lucene-style query parser.
-
Ensure appropriate authentication or network access is configured if Solr is secured or behind a firewall.
-
Deleting large volumes of documents can impact system performance. Use with caution.
If a Fusion-native endpoint for query-based deletions becomes available in future releases, this article will be updated.