Delete By Query
Delete By Query removes every document of your Opensolr Index that matches a query. Use it to clear out part of an index without touching the rest.
Clicking Delete removes every match at once. There is no confirmation step, and *:* matches every document in the index. Check your query first (below).
01 · Steps
- Open the control panel of the index and click Tools in the left menu.
- Type your query in the Delete By Query box. The panel's own example:
uri:*site.com/pathremoves all URLs containingsite.com/path. - Click Delete. The answer reads “Request Sent. DATA DELETED OK”.
No Commit is needed: the documents leave the search results right away. Their disk space is freed when Solr merges the index, or at once with Optimize.
02 · Check your query first
Run the same query as a search and look at numFound: that is how many documents Delete would remove. Click Solr Query in the Quick Actions bar and replace q=*:* in the address with your query.
03 · Query examples
The query uses the standard Solr syntax and the field names of your schema.
| To remove | Query |
|---|---|
| every URL under a path | uri:*site.com/path* |
| one document | id:12345 |
| documents older than a year, by a date field of your schema | your_date_field:[* TO NOW-1YEAR] |
| every document (same documents as Reset) | *:* |
Want everything gone and a clean start? Reset does that in one click.
Index Tools
- Index Tools
- Delete By Query
- Reload
- Reset
- Commit
- Optimize
- Schedule Optimize
- Restart Solr Service